Solved

jQuery Form Plugin Won't Submit

Posted on 2010-08-17
1
511 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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