jquery - form not flagging errors on eachstep & running php code when submitted -
when fields correctit gives msg doesn't run thephp code associated isset how flag errors when next btn clicked before displaying next step/form
<div class="idealsteps-container"> <nav class="idealsteps-nav"></nav> <form class="idealforms" novalidate autocomplete="off" action="/" method="post"> <div class="idealsteps-wrap"> <!-- step 1 --> <section class="idealsteps-step"> <div class="field"> <label class="main">book name:</label> <input name="bookname" type="text" > <span class="error"></span> </div> <div class="field buttons"> <label class="main"> </label> <button type="button" class="next">next »</button> </div> </section> <!-- step 2--> <section class="idealsteps-step"> <div class="field"> <label class="main">code:</label> <input name="code" type="text"> <span class="error"></span> </div> <div class="field buttons"> <label class="main"> </label> <button type="button" class="prev">« prev</button> <button type="submit" id="btn" name="btn" class="submit">submit</button> </div> </section> </div> <span id="invalid"></span> </form> <?php if(isset($_post['btn'])) { echo "submitted"; } ?> <script> $('form.idealforms').idealforms({ silentload: false, rules: { 'bookname': 'required bookname' }, onsubmit: function(invalid, e) { e.preventdefault(); $('#invalid') .show() .toggleclass('valid', ! invalid) .text(invalid ? (invalid +' invalid fields') : 'all good!'); } }); </script>
currently flags errors when submit btn in step2 clicked,how show errors of tht step before proceeding next step run php code when final submit btn clicked
Comments
Post a Comment