I came across a problem with Jquery validate when trying to ensure that a user's email address is unique. I'm trying to validate a user details update form. Now, the email and username are unique, so when I try to validate it with Jquery validate's remote rule, it only sends the value entered, and the server side code tells it that it's in fact taken, even though it's taken by the same user. So, my question is: is there some kind of way to prevent this through jquery validate? Like, maybe some kind of data-original-value attribute of some sort, OR alternatively, is there any way to get it to send additional data with the ajax request, so that I can then use it on the server side code to check whether the value is taken by the same user or not?
Here's my code. It's fairly standard:
$(".validateForm").validate({
rules:
{
handle:
{
required: true,
remote:'/home/check'
}
},
messages:
{
handle:
{
required: "Must include a handle",
remote:"This handle is already used up. Please, choose another one."
}
}
});