2017-02-22 5 views
0

Ich habe unten Code für formValidation auf meiner Seite hinzugefügtgültig() Funktion wird wahr asp.net jquery

$(function() { 
$('#<%=Page.Form.ClientID%>').formValidation({ 
       framework: 'bootstrap', 
       icon: { 
        valid: 'glyphicon glyphicon-ok', 
        invalid: 'glyphicon glyphicon-remove', 
        validating: 'glyphicon glyphicon-refresh' 
       }, 

       // This option will not ignore invisible fields which belong to inactive panels 
       excluded: ':disabled', 

       fields: { 
        mgrbonus: { 
         validators: { 

          regexp: { 
           regexp: /^\d+(\.\d{1,2})?$/, 
           message: '<%=Resources.LocalizedText.ManagerBonusAmountTwodecimalsSepbyDecimal%>' 
          } 
         } 
        }, 
        txtSalaryOption: { 
         validators: { 

          regexp: { 
           regexp: /^\d+(\.\d{1,2})?$/, 
           message: '<%=Resources.LocalizedText.SalaryAmountTwodecimalsSepbyDecimal%>' 
          } 
         } 
        } 
       } 
      }); 

     } 
    }); 

Auf Schaltfläche klicken, rufe ich eine Funktion unter:

<button type="button" class="btn btn-warning" onclick="lastTab();">Lukk</button>--%> 



function lastTab() { 


     if ($('#<%=Page.Form.ClientID%>').valid()) == true) { 
      $('.nav-layout-sidebar a:last').tab('show') 
     } 


    } 

Aber Wenn die Validierung für einige TextBox fehlschlägt, wird sie trotzdem zur nächsten Registerkarte weitergeleitet. Bitte helfen Sie mir, dieses Problem zu lösen. Danke im Voraus.

Antwort

0

Änderung dieser

$('#<%=Page.Form.ClientID%>').validate(); 
if ($('#<%=Page.Form.ClientID%>').valid()) == true) { 
      $('.nav-layout-sidebar a:last').tab('show') 
     } 
+0

werfen Fehler: unerwartete Token == –

Verwandte Themen