paldie
asked on
jQuery Form Plugin Won't Submit
I am building an application with a lot of jQuery that runs on Sean Corfield's Framework 1 in ColdFusion. A lot of forms in the application use jQuery to submit via ajax and validate client side using the Vanadium library.
I recently decided that to unify the forms a little better I would add the jQuery Form plugin. I thought it was working for a little while, but now I am noticing that the validation in my function runs just fine and then nothing happens after that... the ajaxForm function never runs.
I am submitting the form by using an a link that runs submitForm('formid') onclick. I found that I when I used a href="javascript:submitFor m('formid' ) it would actually navigate to www.domain.com/submitForm('formid').
I recently decided that to unify the forms a little better I would add the jQuery Form plugin. I thought it was working for a little while, but now I am noticing that the validation in my function runs just fine and then nothing happens after that... the ajaxForm function never runs.
I am submitting the form by using an a link that runs submitForm('formid') onclick. I found that I when I used a href="javascript:submitFor
function submitForm(formid){
$form = $('#' + formid)
alert('Form with ID of ' + formid + ' was submitted.');
// Show the form loader
$('#' + formid + ' .form-loader').fadeIn('slow');
$('#' + formid + ' #main-advice').remove();
// Validate the form... just in case
Vanadium.validateAndDecorate()
// Check if the form has any errors
if($('#' + formid + '.vanadium-advice').length){
// If so then add an error message
$('#' + formid + '.formBlock').prepend('<span class="vanadium-advice" id="main-advice">Please review errors below and then submit again.</span>').css('align','center');
$('#' + formid + '.form-loader').fadeOut('slow');
return false;
}
try {
$form.ajaxForm({
success: function(){
alert('Hello World');
},
error: function(e){
alert(e);
}
});
} catch(e){
alert(e.description);
}
return true;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.