views:

26

answers:

2

I have a set of elements on a page that where I would like to validate user input. However, the data in these elements is not to be submitted (no postback). Can I do this w/ the jQuery validate plugin? Do the elements have to be in a element anyway?

Thanks

+1  A: 

Checkout your submit button, I mean if it is going to the server side (doing a postback) it's because you have an input type='submit', try changing that button to NOT submit. jQuery works on client-side so it is not running a submit itself, I think you are doing it with the button.

For example:

<input type="submit" onclick="return ValidateForm();">

or

<asp:Button id="btn" runat="server" onClientClick="return ValidateForm();"/>

javascript:

function ValidateForm()
{
    var isValid = false;
    isValid = //Your jquery validation
    return isValid;
}
Darkxes
Yea, the button was it. In my <button> element I need a type="button" to prevent the default type="submit".
ChrisP
A: 
$(selector).validate({submitHandler:function(form) {//do nothing} ...);
EdanB