Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Dear Experts,

I am Stuck in my Asp.net project,

I am Using JQuery Validation in my project.. And i have Include some Javascript files and also a small piece of javascript code in my Index.aspx page.. Here is the below Code....

JavaScript
$('form').validationEngine();


And When i click the submit button it validates the fields.

One of the Javascript file contains a function to validate. And it returns a boolean, if the form get error then it returns False else True.....

I just put an alert in that function and i successfully got the return boolean.

Here is the Below Code.. (This code is in "jquery.validationEngine.js" file)

JavaScript
_onSubmitEvent: function () {
		   
			var form = $(this);
			var options = form.data('jqv');
			options.eventTrigger = "submit";

			// validate each field 
			// (- skip field ajax validation, not necessary IF we will perform an ajax form validation)
			var r=methods._validateFields(form);

			if (r && options.ajaxFormValidation) {
				methods._validateFormWithAjax(form, options);
				// cancel form auto-submission - process with async call onAjaxFormComplete
				return false;
			}

			if(options.onValidationComplete) {
				// !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing
				return !!options.onValidationComplete(form, r);
			}
			
			return r;
			
		},



I need to get this return boolean in my Index.aspx page.....


Is there any Javascript code to get the return value....

Please help me..

Thanks and Regards,

Dileep.....
Posted
Comments
ZurdoDev 3-Apr-13 15:02pm    
I am confused. Where do you want the return value? Your code is already returning r or false, or !!options...

Hi You Can Refer This Website for validation engine

http://www.aspdotnet-suresh.com/2012/01/jquery-beautiful-popup-form-validations.html[^]

Regards,
 
Share this answer
 
Hello,

Rather than attaching the validation engine to a form you can use .validate method in your own submit handler. That way you can chose to take an appropriate action based on the return value. See doc here[^]

Regards,
 
Share this answer
 
Comments
dilzz 4-Apr-13 1:06am    
Thank You Sir.... Its Working..... Thanks a lot... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900