2

i am using jquery client side validation in asp.net.

the problem i am facing now is that whenever i click any button in a page it causes validation rather than for specific button alone.

how to resolve this .?

thank you

1
  • Can you please clarify. What does 'whenever i click any button in a page it causes validation rather than for specific button alone' mean? Commented Dec 28, 2010 at 5:20

2 Answers 2

3

Suppose you have two buttons SubmitButton and CancelButton and you do not want to CancelButton to fire validation plugin, just give CssClass="cancel" for CancelButton

    <asp:Button ID="CancelButton" runat="server" 
            Text="Return to List" 
            CssClass="cancel" />
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you naveen ..it works..if you can explain the exact reason for this?
@SAK: Jörn Zaefferer designed the plugin like that. I dont see any documentation for that though
2

You want to use event.preventDefault().

http://api.jquery.com/event.preventDefault/

$("button").click(function(event) {
    event.preventDefault();
    // do stuff here
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.