Solved

jQuery Form Plugin Won't Submit

Posted on 2010-08-17
1
505 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

14 Experts available now in Live!

Get 1:1 Help Now