how to validate a form without displaying any error messages -


i not understand how can validate form jquery validate display submit button or not.

my javascript follows:

ko.bindinghandlers.jqvalidate = { init: function (element, valueaccessor, option) {      var element = element;      var validateoptions = {         ignore: [":hidden:not(required)"],         focuscleanup: true,         onsubmit: true     };      function displaysubmitbutton() { // remove/add class submit button         if ($('form').valid()) $('.tosave').show();         else $('.tosave').hide();     }      $('form').bind('onchange keyup onpaste', function (event, element) {         if ($('form').valid() === true && $(element).not('.resetform')) $('.tosave').show();         else if ($(element).not('.resetform')) $('.tosave').hide();     }); } }; 

my form :

<ol class="mutcolor13 mouseover" data-bind="jqvalidate: {}">     <li class="rightcol">         <strong>             <label for="iemailreply"><asp:literal runat="server" id="lemailreply" /></label>         </strong>         <input id="iemailreply" name="emailreply" type="text" tabindex="2"             class="mutcolor13 email"             data-bind="value: communication.message.replyemail, valueupdate: 'afterkeydown'"             required="required" />     </li>     <li class="leftcol">         <strong>             <label for="iemailfrom"><asp:literal runat="server" id="lemailfrom" /></label>         </strong>         <input id="iemailfrom" name="emailfrom" type="text" tabindex="1"             class="mutcolor13 email"             data-bind="value: communication.message.senderemail, valueupdate: 'afterkeydown'"             required="required" />     </li>     <!-- , more form input --> </ol> 

my submit button :

<div class="buttonblock rightbutton"  data-bind="fadevisible: validatemessage()">     <a class="mutbutton3 tosave" data-bind="click: savemessage"><span class="mutbutton3">submit</span></a> </div>  

when type "$ ('form'). valid ()" in firebug console, error messages appear. not think submit button problem because have not clicked @ point

how enable display of error message input short change while allowing display of submit button if fields (and other form fields in page) if fields valid?

i inspired question: jquery validate: if form valid show submit button

a working demo : http://jquery.bassistance.de/validate/demo/ but button displayed continuously

ok think work:

http://jsfiddle.net/ay972/10/

what did :

  $('form').bind('change oninput', function (event, element) {         console.log('formlive :: ', $(event));          if ($('form').valid() === true && $(element).not('.resetform')) $('.tosave').show();         else if ($(element).not('.resetform')) $('.tosave').hide();     }); 

the 'change oninput' seems work.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -