Solved

jQuery Form Plugin Won't Submit

Posted on 2010-08-17
1
502 Views
Last Modified: 2012-05-10
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:submitForm('formid') it would actually navigate to www.domain.com/submitForm('formid').
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;
}

Open in new window

0
Comment
Question by:paldie
1 Comment
 

Accepted Solution

by:
paldie earned 0 total points
ID: 33458239
Found out that all ajaxForm() does is setup the form to use Ajax upon submit.  I needed to use ajaxSubmit() to actually submit the form.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now