Validation of Validator

Source: Internet
Author: User

Usually like to write this verification

<form method="Post"data-ajax="false"action="/shppping/placeorder"Id="OrderForm"> <aclass="Btnpay"href="javascript:void (0)"onclick="return Checksubmit ();"Id="Btnpay"> Payments </a> <aclass="Btncancel"Id="Btncancel"href="javascript:void (0)"> Cancel </a></form>

Then there's the Checksubmit method.

function Checksubmit () {varErrorMsg =""; varSJ = $ ("#ordertime"); varSFZ = $ ("#orderncerti"); varDyz = $ ("#ordernguideCard"); varLxs = $ ("#orderntravelAgency"); varSMR = $ ("#ordername"); varSJH = $ ("#orderphone"); if(Sj.length >0&& sj.val () = ="") {errormsg="Please select a travel date"; }        Else if(Sjh.length >0&& sjh.val () = ="") {errormsg="phone number is not correct"; }        Else if(Smr.length >0&& smr.val () = ="") {errormsg="please fill in your name"; }        Else if(Sfz.length >0&& sfz.val () = ="") {errormsg="please fill in the ID number"; }        Else if(Dyz.length >0&& dyz.val () = ="") {errormsg="please fill in the Guide card number"; }        Else if(Lxs.length >0&& lxs.val () = ="") {errormsg="please fill in the name of travel agency"; }                Else if($(". Ochooseno1.active"). Length = =0|| $(". Ochooseno2.active"). Length = =0) {errormsg="Please select a payment method"; }        if(ErrorMsg! ="") {alert (errormsg); return false; }        //$ ("#orderForm"). Submit ();Alert"Submit Success"); return false; //return true;}

Then there is the use of validate.js

Validation of Validator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.