Why this codes not functioning well?

Hi guys,

I have this method below,


		function validate(formData, jqForm, options) {
		    // fieldValue is a Form Plugin method that can be invoked to find the current value of a field
		    // To validate, we can capture the values of both the username and password
		    // fields and return true only if both evaluate to true
		
		    var title 		 = $('input[name=title]').fieldValue();
		    var url 		 = $('input[name=url]').fieldValue();
		    var description  = $('input[name=description]').fieldValue();
		
		    // usernameValue and passwordValue are arrays but we can do simple
		    // "not" tests to see if the arrays are empty
		    if (!title[0] || !url[0] || !description[0]) {
		        alert('Please enter a value for both Title, URL and Description');
		        return false;
		    }
		
		    return true;
		}

The method should validate the three input fields which are the “title”, “url” and “description”.
The problem is even thought all fields are filled with value it still show up the alert() message.

Any help please.

Thanks in advaned.

By the way I got that method from this plugin,
http://www.malsup.com/jquery/form/#validation

Any help please?

There’s nothing obviously wrong with the code you posted. The problem is somewhere in the rest of your code. Could you post a link to the page (or, if that’s not possible, post the full code of the page here)?