zoukankan      html  css  js  c++  java
  • formvalidation表单验证

    官方文档:http://formvalidation.io

    var $formEntityProfileSearch = $("form[name=entityProfileSearch]");

    var $formValidationEntityProfileSearch = $formEntityProfileSearch.data("formValidation");

    //初始化表单验证

    $formValidationEntityProfileSearch.revalidateField('companyFullName');

    //支持单一字段重新验证

    formValidationEntityProfileSearch.resetField();

    //重置验证字段

    一个表单多个提交按钮

    formSubmit.off('success.form.fv.submit');

    formSubmit.on('success.form.fv.submit', function(e) {

    var $form = $(e.target), // Form instance

    // Get the clicked button

    $button = $form.data('formValidation').getSubmitButton();
    switch ($button.attr('name')) {

    case 'save':

    e.preventDefault();

    var formData = Utils.formArrayToObject(formSubmit.serializeArray());

    formData.shippmentFee=oldshippmentFee;

    var data = $.extend({},jsonresult,formData);

    BootstrapDialog.confirm({

    title: "发货信息确认",

    message: "确定保存发货信息吗?",

    type: BootstrapDialog.TYPE_DANGER,

    callback: function(res) {

    if(res){

    Utils.ajax({

    scope:formSubmit,

    url:"./order/orderdelivery/save_order_delivery_information",

    type:"POST",

    dataType:"json",

    contentType:"application/json",

    data:JSON.stringify(data),

    normalCallback:function(result){

    BootstrapDialog.success("保存成功",function(){

    dialog.close();

    $dttbltaskorder.draw();

    });

    }

    });

    }

    }

    })

    break;

    case 'dispatching':

    e.preventDefault();

    var formData = Utils.formArrayToObject(formSubmit.serializeArray());

    formData.shippmentFee=oldshippmentFee;

    var data = $.extend({},jsonresult,formData);

    BootstrapDialog.confirm({

    title: "发货确认",

    message: "确定发货吗?",

    type: BootstrapDialog.TYPE_DANGER,

    callback: function(res) {

    if(res){

    Utils.ajax({

    scope:formSubmit,

    url:"./order/orderdelivery/submit_shippment",

    type:"POST",

    dataType:"json",

    contentType:"application/json",

    data:JSON.stringify(data),

    normalCallback:function(result){

    BootstrapDialog.success("发货成功",function(){

    dialog.close();

    $dttbltaskorder.draw();

    });

    }
    })

    }

    }

    })

    break;

    }

    });

    电话验证:

     data-fv-phone="true" data-fv-phone-country="CN"

    支持html5的标签属性:参考 http://formvalidation.io/validators/

    博客地址:http://www.cnblogs.com/windseek/

     

    学而不思则罔,思而不结则殆,结而不看,一事无成
  • 相关阅读:
    FPGA边缘检测
    Luogu P5856 【「SWTR-03」Game】
    Luogu P4707 【重返现世】
    Weight Balanced Leafy Tree
    Luogu P4311 【士兵占领】
    Luogu P4174 【[NOI2006]最大获利】
    Luogu P1646 【[国家集训队]happiness】
    Luogu P4313 【文理分科】
    Luogu P4249 【[WC2007]剪刀石头布】
    Luogu P2754 【[CTSC1999]家园 / 星际转移问题】
  • 原文地址:https://www.cnblogs.com/windseek/p/5939542.html
Copyright © 2011-2022 走看看