zoukankan      html  css  js  c++  java
  • $('#').formValidation校验网址

    $('#addCarouselInfoForm').formValidation({

    message: '格式不正确',

    //不忽略隐藏域验证
    excluded: [],
    icon: {
    valid: 'glyphicon glyphicon-ok',
    invalid: 'glyphicon glyphicon-remove',
    validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
    //图片上传验证
    "fileId" : {
        trigger:"change",
          validators : {              
              notEmpty : {               
              message : '请上传图片'          
               }       
              }   
             },

    intro: {
    row: '.col-sm-9',
    validators: {
    notEmpty: {
    message: '图片简介名称不能为空'
    },
    stringLength: {
    min: 1,
    max: 32,
    message: '您已超出最大输入限制'
    }
    }
    },

    link: {
    row: '.col-sm-9',
    validators: {
    notEmpty: {
    message: '链接不能为空'
    },
    regexp: {
    message: '请输入正确的链接地址',
    regexp: /^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~/])+$/,
    }
    }
    },

    sort: {
    row: '.col-sm-9',
    validators: {
    notEmpty: {
    message: '序号不能为空'
    },
    stringLength: {
    min: 1,
    max: 6,
    message: '您已超出最大输入限制'
    }
    }
    }
    }
    }).on('success.form.fv', function(e) {
    e.preventDefault();
    var $form = $(e.target);

    var bv = $form.data('formValidation');
    $.post($form.attr('action'), $form.serialize(), function(result) {
    if(result.data==true){
    //提交成功后回调函数
    bt_alert('提示','添加成功');
    window.location.href='';
    }else{
    bt_alert ('提示','添加失败');
    }
    }, 'json');
    });

  • 相关阅读:
    使用DirectX作渲染过程
    记于来北京两个星期
    添加 node mocha 测试模块
    for-of循环
    app-web 开发 追溯debug
    cmd关闭被占用的端口命令及教程详解
    vue使用element-ui的el-input监听不了键盘事件解决
    Nodejs 进阶:Express 常用中间件 body-parser 实现解析
    nodejs设置允许跨域
    nodejs 全局变量和全局对象
  • 原文地址:https://www.cnblogs.com/guangxiang/p/10251839.html
Copyright © 2011-2022 走看看