javascript - validate a form when using modal? -


i try make form validation, if hit submit, form disapears before giving me feedback:

<div class="ui right aligned grid">     <div class="ui 3 wide column">         <div class="ui center aligned inverted orange segment">              <div class="ui animated fade large inverted button" onclick="contact()">               <div class="visible content">say something!</div>               <div class="hidden content">express ;)</div>         </div>     </div>     </div> </div> <div class="ui first coupled modal"> <i class="close icon"></i> <div class="header"> tell me </div> <div class="content"> <form class="ui form" method="post" action="/msg">     <h4 class="ui dividing header">what think</h4>     <div class="field">       <label><i class="write icon"></i></label>       <textarea name="txt" class="field" placeholder="write something" required></textarea>       <input class="ui green button" type="submit" value="gtt"/>     </form>   </div> </div> </div> <div class="ui small second coupled modal"> <div class="header"> <i class="red heart icon"></i> </div> <div class="content">   <div class="description">      <h1>thank you</h1>    </div> </div> <div class="actions">   <div class="ui approve inverted blue button">     <i class="checkmark icon"></i>     bye ^_^   </div> </div> 

the js:

 function contact(){          $('.coupled.modal')           .modal({             allowmultiple: false           })         ;         // attach events buttons         $('.second.modal')           .modal('attach events', '.first.modal .button')         ;         // show first         $('.first.modal')           .modal('show')         ;         } 

and here how first windows diseapears without letting me validate. enter image description here

update: added validation, doesent work:

$('.ui.form')   .form({     message: {     identifier  : 'msg',     rules: [      {       type   : 'empty',       prompt : 'please enter message'      }    ]       },    }) 

;

where onapprove , ondeny callbacks perform logic?

the fact modal fades dimmer stays on screen suggests error in js. go debugger , find out.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -