Before submitting a JQuery form, verify that the ticket is selected and the record is deleted.
First three:
These functions may be frequently required in Java Web development. Although they are simple, they are very useful. Record them here to avoid forgetting them.
1. Verify the form before submission: It is often used in the background (here is the unified verification after submission. for timely verification, please refer to my other article
Http://blog.csdn.net/jianzhonghao/article/details/52503431)
1.1 after the submit button is submitted, the corresponding path will be redirected based on the form attribute action = "path". In this case, add an onsubmit = "return check ()" attribute to the form, check () enables us to write verification functions, such:
<Form action = "path" onsubmit = "return check ()" method = "POST">
1.2 check () function is as follows (verify whether the name is filled in with the gender of the single region is selected) $ ('# notice'), just write a div and add an id attribute.
<Script type = "text/javascript"> function check () {var name = $ ('# name '). val (). trim (); var gender = $ ('input: radio [name = "gender"]: checked '). val (); if (! Name) {$ ('# notice'). text ('customer service name cannot be blank! '). Show (); return false;} else if (! Gender) {$ ('# notice'). text ('select the customer service gender! '). Show (); return false;} else {return true ;}</script> <div id = "notice" style = "font-size: 30px; color: red; margin-top: 15px; "> </div>
1.3 check whether the deletion is deleted.
<Input type = "image" src = "Path of the delete icon" title = "delete" onclick = "{if (confirm ('Are you sure you want to delete it? ') {Javascript: document: delfrom _ $ {ServerInfo. id}; return true;} return false;} "> separate write is actually if (confirm (' Are you sure you want to delete it? ') {Javascript: document: delfrom _ $ {ServerInfo. id}; return true;} return false;
The above is a summary of the validation experience on checking whether a single sheet is selected and deleting records before submitting JQuery form. I hope it will be helpful to you, if you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!