I have created an aspx form. I am Using JQuery validation engine (http://www.position-relative.net/creation/formValidator/) for validation.
Now, I want to notify the user whether the used id already exists in the database with the same red balloon error tip (default for jquery validation engine).
I searched google and got some tips but I am confused about how to pass arguments to the webmethod involved in the ajaxcall.
This is the code given in github site (http://posabsolute.github.io/jQuery-Validation-Engine/#options/ajaxformvalidation):
"ajaxUserCall": {
"url": "~/Page.aspx/ajaxValidateFieldUser",
"extraData": "name=eric",
"extraDataDynamic": ['#user_id', '#user_email'],
"alertText": "* This user is already taken",
"alertTextOk": "All good!",
"alertTextLoad": "* Validating, please wait"
}
I have understood it in the following way. Please correct me if I am wrong.
1) I have included this block of code in 'jquery.validationEngine.js' file. 2) I have created webmethod 'ajaxValidateFieldUser' in .Page.aspx'. It is as follows:
[WebMethod]
public static bool IsUserAvailable(string username)
{
if (record does not exist in table) // do not worry about this part of code. It is just for example
return true;
else
return false;
}
3) In the userId textbox, I have added the class 'validate[ajaxValidateFieldUser]'.
4) Of course, I have added proper jquery files so that the other validations of JQuery ValidationEngine are working properly.
It is not working. I am not sure how to pass username parameter (which is the input of used id textbox) to the webmethod.