验证用户名为手机号或者是QQ号或者是QQ邮箱



<input name="username" type="text" autocomplete="off" placeholder="手机号码或者QQ号或者QQ邮箱" maxlength="20"

  class="input-text" datatype="/^1[3|4|5|7|8][0-9]{9}$/ | /^[1-9]\d{4,14}$/ | /^[1-9]\d{4,14}@(qq|QQ).com$/" nullmsg="请输入用户名!"

  sucmsg="用户名格式正确!" errormsg="手机号码或者QQ号或者QQ邮箱"/>




#set( $basePath = "$request.contextPath" )
#set( $staticPath = "$basePath/assets" )
#parse("/common/header.vm")
<div class="pd-20">
<form  method="post" class="form form-horizontal" id="userform">
<div class="row cl">
<label class="level level2 form-label col-xs-4 col-sm-2">登录名:</label>
<div class="formControls col-xs-8 col-sm-3">
<input name="username" type="text" autocomplete="off" placeholder="手机号码或者QQ号或者QQ邮箱" maxlength="20"
  class="input-text" datatype="/^1[3|4|5|7|8][0-9]{9}$/ | /^[1-9]\d{4,14}$/ | /^[1-9]\d{4,14}@(qq|QQ).com$/" nullmsg="请输入用户名!"
  sucmsg="用户名格式正确!" errormsg="手机号码或者QQ号或者QQ邮箱"/>
</div>
<div class="formControls col-xs-8 col-sm-7">
</div>
</div>
<div class="row cl">
<label class="level level2 form-label col-xs-4 col-sm-2">登录密码:</label>
<div class="formControls col-xs-8 col-sm-3">
<input name="password" type="password" class="input-text" autocomplete="off" maxlength="20"
  placeholder="请输入6-20,任意字符组合,不包括空格!" class="input-text" datatype="/^[^\s]{6,20}$/"
  nullmsg="请输入登录密码!" sucmsg="密码格式正确!" errormsg="格式错误,请输入6-20,任意字符组合,不包括空格!"/>
</div>
<div class="formControls col-xs-8 col-sm-7">
</div>
</div>
<div class="row cl">
<label class="level level2 form-label col-xs-4 col-sm-2">再次输入登录密码:</label>
<div class="formControls col-xs-8 col-sm-3">
<input name="password2" type="password" class="input-text" autocomplete="off" placeholder="请再次输入登录密码!" maxlength="20"
  class="input-text" datatype="*" recheck="password" nullmsg="请再次输入登录密码!" sucmsg="密码正确!" errormsg="两次输入密码不匹配!"/>
</div>
<div class="formControls col-xs-8 col-sm-7">
</div>
</div>
<div class="row cl">
<div class="formControls col-xs-8 col-sm-offset-2">
<input class="btn btn-primary radius mr-20" type="submit" value="确认添加">
<input class="btn btn-primary radius" type="button" value="返回" οnclick="backUrl();">
</div>
</div>
</form>
</div>
<script type="text/javascript" src="$staticPath/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">
$(function () {
    $("#userform").Validform({
        tiptype: 2,
        callback: function (data) {
            var data = $("#userform").serialize();
            $.ajax({
                type: 'POST',
                dataType: "json",
                data: data,
                url: '$basePath/user/submitAdd',
                success: function (data) {
                    if (data.code == 0) {
            layer.confirm('用户添加成功!', {
             btn: ['确认'] //按钮
            }, function(){
                            window.location = "$basePath/user/userList";
            });
                    } else {
                    layer.alert("添加用户失败:"+data.data, {icon: 5});
                    }
                }, error: function (err) {
                    layer.alert("服务器忙,请稍后再试!", {icon: 5});
                }
            });
            return false;
        }
    });
});


function backUrl(){
window.location.href="$basePath/user/userList";
}
</script> 
#parse("/common/bottom.vm")

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值