Solved

jQuery Form Plugin Won't Submit

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

742 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