Solved

jQuery Validate: Event if all valid and form submitted

Posted on 2011-03-02
7
872 Views
Last Modified: 2012-05-11
Hi,

I'm using jQuery Validate plugin from here - http://bassistance.de/jquery-plugins/jquery-plugin-validation/

The goal is to fire those two events only after jQuery validates all required fields and form has been submitted.

My code below does not work properly.

Any idea how to make it properly?

Thanks in advance
$("form").validate({
			    
success: function(html) { 
	$("form").submit(function(){
		$("input[type='submit']").attr("disabled", true).val("Please wait...");
		$(".stillloading").delay(4000).fadeIn(200);
	});
	}

});

Open in new window

0
Comment
Question by:Aidam-Unlimited
  • 3
  • 2
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 35021583
When you submit your form, you stay away from the page and so, from your code.
You're on another page, perhaps with the same url but an other new page

You may use ajax to submit your form silently and after the submission, display a message and go away

Check this plugin : http://jquery.malsup.com/form/#ajaxSubmit

0
 
LVL 82

Expert Comment

by:leakim971
ID: 35325755
How did you resolve it?
0
 

Accepted Solution

by:
Aidam-Unlimited earned 0 total points
ID: 35325848
Solution is here.

If somebody found this useful, please let me know (post a comment).
$(document).ready(function() {

	$("form").validate({
	 submitHandler: function(form) {
		$("input[type='submit']").attr("disabled", true).val("Please wait...");
	   form.submit();
	 },
	 errorPlacement: function(error, element) { } //Removed error labels, I've got input {border: red;} only
	});
	
});

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Aidam-Unlimited
ID: 35325860
//Objecting
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35326183
Thanks
0
 

Expert Comment

by:ModCorlEEone
ID: 35364775
Restarting auto-close process on Aidam-Unlimited's behalf after posting own solution.
 
ModCorlEEone
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

713 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