0

I have applied Jquery validation engine for form1 runat server. in this form i have 3 buttons submit,cancel,print. for all the buttons these validations are working but the validations should work only for on submit button click. how to disable cancel and print buttons from these validations... please give me solution..

Thank You.

  • 2
    What you tried? if you have tried something then put it here so it will be easy to answer from this way you will find 100 answer and - rating – Just code Nov 28 '13 at 05:27

6 Answers6

0

Set class="cancel" to the other button, and it'll skip validation.

Monika
  • 2,172
  • 15
  • 24
0

Try according this

<input type="submit" value="Submit" />
<input type="button" value="Cancel" />
<input type="button" value="Print" />
Vijay Singh
  • 317
  • 2
  • 9
0

just add the tag inside your form tag.

<form name="ff1" method="post" onsubmit="validateForm();">

Type of button needs to be submit and for other reset and cancel it should be type=button.

Indranil.Bharambe
  • 1,462
  • 3
  • 14
  • 25
0

you can use ValidationGroup property for both validator and button like this:

<asp:RequiredFieldValidator ID="UserNameRequiredFieldValidator"  runat="server" Text="*" ControlToValidate="UserNameTextBox" ValidationGroup="GroupOne"  />

<asp:Button ID="EnterButton" runat="server" Text="Enter" CausesValidation="true" OnClick="EnterButton_Click"  ValidationGroup="GroupOne" />

use ValidationGroup for only that one button which you need to causes validation.

Masoumeh Karvar
  • 791
  • 1
  • 14
  • 32
0

This is another very similar question - specific to ASP.NET with some answers specific to Microsoft's validation framework

jQuery Validation plugin: disable validation for specified submit buttons

Community
  • 1
  • 1
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
0

` $(function () { $('[id*=btnSubmit]').bind("click", function () { $("#form1").validationEngine('attach', { promptPosition: "topRight" }); }); $('[id*=btnCancel]').bind("click", function () { $("#form1").validationEngine('detach'); }); }); ` $(function () { $('[id*=btnSubmit]').bind("click", function () { $("#form1").validationEngine('attach', { promptPosition: "topRight" });`enter code here` }); $('[id*=btnCancel]').bind("click", function () { $("#form1").validationEngine('detach'); }); });

mcbalaji
  • 183
  • 3
  • 13