Cannot submit the form successfully using Form Plugin
Hi
I'm new to JQuery and used Form Plug-in examples to validate my form before submitting
Now my form submits only if all field being filled,but then the submit does not work !
The Firebug logs a successful submit but the url does not change to the submit form
This is my Code :
$('#registration_form').ajaxForm( { beforeSubmit: validate } ); //Add beforesubmit method to registration form
function validate(formData, jqForm, options) //Validate bofore submiting form
{
var firstname = $('input[name=firstname]').fieldValue();
var lastname = $('input[name=lastname]').fieldValue();
var username = $('input[name=username]').fieldValue();
var password = $('input[name=password]').fieldValue();
var password_repeat = $('input[name=password_repeat]').fieldValue();
var type = $('select[name=type]').fieldValue();
var Personal_id = $('input[name=Personal_id]').fieldValue();
if (!firstname[0] || !lastname[0] || !username[0] || !password[0] || ! password_repeat[0] || !Personal_id[0])
{
alert('Please fill the form');
return false; //Cancel the submission process
}
else if (password[0] != password_repeat[0])
{
alert('Please enter password correctly');
return false; //Cancel the submission process
}
}
What's the problem ?
Thanks a lot