NutzCN Logo
问答 替换了页面表单里面的值 提交 却获取不到值
发布于 2925天前 作者 Hamming 2064 次浏览 复制 上一个帖子 下一个帖子
标签:

为什么替换了页面表单里面的值 提交 却获取不到值?求解答

<!DOCTYPE html>
<html class="signin no-js" lang="${lang!}">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <meta name="description" content="${AppName!}">
    <title>${AppName!}</title>
    <link rel="stylesheet" href="${base!}/assets/plugins/stepy/jquery.stepy.css">
    <link rel="stylesheet" href="${base!}/assets/bootstrap/css/bootstrap.min.css">
<!--    <link rel="stylesheet" href="${base!}/assets/css/font-awesome.css">
    <link rel="stylesheet" href="${base!}/assets/css/themify-icons.css">
    <link rel="stylesheet" href="${base!}/assets/css/animate.min.css">
    <link rel="stylesheet" href="${base!}/assets/css/skins/palette.css">
    <link rel="stylesheet" href="${base!}/assets/css/fonts/font.css">
    <link rel="stylesheet" href="${base!}/assets/css/main.css">
    <link rel="stylesheet" href="${base!}/assets/css/panel.css">-->
    <link rel="stylesheet" href="${base!}/assets/plugins/jstree/themes/default/style.min.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/treetable/jquery.treetable.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/chosen/chosen.min.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/marquee/marquee.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/marquee/example.css">

    <link rel="stylesheet" href="${base!}/assets/plugins/datepicker/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/emoji/emoji.css">
    <link rel="stylesheet" href="${base!}/assets/plugins/x-editable/bootstrap-editable.css">
    <!--[if lt IE 9]>
    <script src="${base!}/assets/js/html5shiv.js"></script>
    <script src="${base!}/assets/js/respond.min.js"></script>
    <script src="${base!}/assets/js/json2.js"></script>
    <![endif]-->
    <script src="${base!}/assets/plugins/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
        var base = '${base!}';
    </script>

</head>
<body>
<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/opo/opo_users/addDo" method="post">
                <div class="row mb10">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label for="loginname" class="col-sm-2 control-label">用户名</label>

                            <div class="col-sm-8">
                                <input type="text" id="loginname" class="form-control" name="loginname" data-parsley-required="true" placeholder="用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="password" class="col-sm-2 control-label">登陆密码</label>

                            <div class="col-sm-8">
                                <input type="password" id="password" class="form-control" name="password" data-parsley-required="true" placeholder="登陆密码">
                            </div>
                        </div>
<!--                        <div class="form-group">
                            <label for="safe_password" class="col-sm-2 control-label">二级密码</label>
                            <div class="col-sm-8">
                            <input type="password" id="safe_password" class="form-control" name="safe_password" data-parsley-required="true" placeholder="二级密码">
                            </div>
                        </div>-->
                        <div class="form-group">
                            <label for="real_name" class="col-sm-2 control-label">真实姓名</label>
                            <div class="col-sm-8">
                            <input type="text" id="real_name" class="form-control" name="real_name" data-parsley-required="true" placeholder="也许昵称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="Id_card" class="col-sm-2 control-label">身份证</label>
                            <div class="col-sm-8">
                            <input type="text" id="Id_card" class="form-control" name="Id_card" data-parsley-required="true" placeholder="身份证">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="phone" class="col-sm-2 control-label">手机号</label>
                            <div class="col-sm-8">
                            <input type="text" id="phone" class="form-control" name="phone" data-parsley-required="true" placeholder="例如: 13588135888">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="safe_question" class="col-sm-2 control-label">密保问题</label>
                            <div class="col-sm-8">
                                <select  id="safe_question" class="form-control" name="safe_question" data-parsley-required="true" placeholder="密保问题">
                                    <option>请选择</option>
                                    <option>您的姓名是?</option>
                                    <option>您的家乡是?</option>
                                    <option>您最敬佩的人是?</option>
                                </select>
                            <!--<input type="text" id="safe_question" class="form-control" name="safe_question" data-parsley-required="true" placeholder="密保问题">-->
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="safe_solution" class="col-sm-2 control-label">密保答案</label>
                            <div class="col-sm-8">
                            <input type="text" id="safe_solution" class="form-control" name="safe_solution" data-parsley-required="true" placeholder="密保答案">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="bank_account_name" class="col-sm-2 control-label">银行账号姓名</label>
                            <div class="col-sm-8">
                            <input type="text" id="bank_account_name" class="form-control" name="bank_account_name" data-parsley-required="true" placeholder="银行账号姓名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="bank" class="col-sm-2 control-label">银行开户行</label>
                            <div class="col-sm-8">
                            <!--<input type="text" id="bank" class="form-control" name="bank" data-parsley-required="true" placeholder="银行开户行">-->
                                <select  id="bank" class="form-control" name="bank" data-parsley-required="true" placeholder="银行开户行">
                                    <option>中国银行</option>
                                    <option>中国农业银行</option>
                                    <option>中国建设银行</option>
                                    <option>中国工商银行</option>
                                    <option>北京银行</option>
                                    <option>兴业银行</option>
                                    <option>招商银行</option>
                                    <option>民生银行</option>
                                    <option>交通银行</option>
                                    <option>光大银行</option>
                                    <option>中国邮政储蓄银行</option>
                                    <option>平安银行</option>
                                    <option>中信银行</option>
                                    <option>华夏银行</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="bank_branch" class="col-sm-2 control-label">开户行详细资料</label>
                            <div class="col-sm-8">
                            <input type="text" id="bank_branch" class="form-control" name="bank_branch" data-parsley-required="true" placeholder="例如:广东省深圳市分行">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="bank_account" class="col-sm-2 control-label">银行账号</label>
                            <div class="col-sm-8">
                                <input type="text" id="bank_account" class="form-control" name="bank_account" data-parsley-required="true" placeholder="银行账号">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="alipay" class="col-sm-2 control-label">支付宝账号</label>
                            <div class="col-sm-8">
                            <input type="text" id="alipay" class="form-control" name="alipay" data-parsley-required="true" placeholder="支付宝账号">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="we_chat" class="col-sm-2 control-label">微信</label>
                            <div class="col-sm-8">
                            <input type="text" id="we_chat" class="form-control" name="we_chat" data-parsley-required="true" placeholder="微信">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inviter" class="col-sm-2 control-label">邀请人</label>
                            <div class="col-sm-8">
                            <input type="text" id="inviter" class="form-control" name="inviter"  placeholder="邀请人" disabled>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inviter_phone" class="col-sm-2 control-label">领导人电话号码</label>
                            <div class="col-sm-8">
                            <input type="text" id="inviter_phone" class="form-control" name="inviter_phone" placeholder="领导人电话号码" disabled>
                            </div>
                        </div>
                        <input type="hidden" id="inviId" class="form-control" name="inviId"  placeholder="邀请人ID" disabled>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>
    </div>
</div>
<!--script-->
<script src="${base!}/assets/plugins/modernizr.js"></script>
<script src="${base!}/assets/js/jquery.pjax.js"></script>
<script src="${base!}/assets/bootstrap/js/bootstrap.js"></script>
<script src="${base!}/assets/plugins/jquery.form.js"></script>
<script src="${base!}/assets/plugins/parsley.min.js"></script>
<script src="${base!}/assets/plugins/parsley.zh_cn.js"></script>
<script src="${base!}/assets/plugins/jquery.sortable.js"></script>
<script src="${base!}/assets/plugins/jquery.nestable.js"></script>
<script src="${base!}/assets/plugins/icheck/icheck.js"></script>
<script src="${base!}/assets/plugins/jquery.slimscroll.min.js"></script>
<script src="${base!}/assets/plugins/jquery.easing.min.js"></script>
<script src="${base!}/assets/plugins/appear/jquery.appear.js"></script>
<script src="${base!}/assets/plugins/jquery.placeholder.js"></script>
<!-- marquee-->
<script src="${base!}/assets/plugins/marquee/marquee.js"></script>

<script src="${base!}/assets/plugins/fastclick.js"></script>
<script src="${base!}/assets/plugins/count-to/jquery.countTo.js"></script>
<script src="${base!}/assets/js/toast.js"></script>
<script src="${base!}/assets/plugins/chosen/chosen.jquery.min.js"></script>
<script src="${base!}/assets/plugins/treetable/jquery.treetable.js"></script>
<script src="${base!}/assets/plugins/datatables/jquery.dataTables.js"></script>
<script src="${base!}/assets/plugins/datatables/dataTables.bootstrap.js"></script>
<script src="${base!}/assets/plugins/jstree/jstree.min.js"></script>
<script src="${base!}/assets/plugins/switchery/switchery.js"></script>
<script src="${base!}/assets/plugins/stepy/jquery.stepy.js"></script>
<script src="${base!}/assets/plugins/stepy/jquery.validate.min.js"></script>
<script src="${base!}/assets/plugins/icheck/icheck.js"></script>
<script src="${base!}/assets/plugins/chosen/chosen.jquery.min.js"></script>
<script src="${base!}/assets/plugins/jquery.form.js"></script>
<script src="${base!}/assets/plugins/uploadifive/jquery.uploadifive.min.js"></script>
<script src="${base!}/assets/plugins/datepicker/bootstrap-datetimepicker.min.js"></script>
<script src="${base!}/assets/plugins/datepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${base!}/assets/plugins/emoji/emoji.js"></script>
<script src="${base!}/assets/plugins/sorttable/Sortable.min.js"></script>
<script src="${base!}/assets/plugins/jquery.qrcode.min.js"></script>
<script src="${base!}/assets/plugins/jquery.sparkline.js"></script>
<script src="${base!}/assets/plugins/x-editable/bootstrap-editable.js"></script>
<script src="${base!}/assets/plugins/moment.min.js"></script>
<script src="${base!}/assets/js/form.js"></script>
<script src="${base!}/assets/js/offscreen.js"></script>
<script src="${base!}/assets/js/main.js"></script>
<script src="${base!}/assets/js/page.js"></script>
<script src="${base!}/assets/js/date.js"></script>
<script language="JavaScript">
    $(document).ready(function () {
        var inviId = '${inviId}';
        if(inviId!="temp"){
            $("#inviId").val(inviId);
        }
        var real_name = '${real_name}';
        var phone = '${phone}';
        if(real_name!="temp"){
            $("#inviter").val(real_name);
        }
        if(phone!="temp"){
            $("#inviter_phone").val(phone);
        }

        $('#addForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    //刷新父级菜单
                    form.resetForm();
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>


</body>
6 回复

方法

	@At
    @Ok("json")
    @SLog(tag = "新建用户", msg = "")
    public Object addDo(@Param("inviId") String inviId,
						@Param("..") opo_user opoUser,
						@Param("loginname") String loginname,
						@Param("password") String password,
						HttpServletRequest req) {
		try {
			Sys_user user =new Sys_user();
			user.setLoginname(loginname);
			user.setPassword(password);
			String msg = userService.checkApp_user(user,true);
			if(msg!=null){
				return Result.error(msg);
			}
			if(opoUser!=null&&opoUser.getReal_name()!=null){
				user.setNickname(opoUser.getReal_name());
				RandomNumberGenerator rng = new SecureRandomNumberGenerator();
				String salt = rng.nextBytes().toBase64();
				String hashedPasswordBase64 = new Sha256Hash(user.getPassword(), salt, 1024).toBase64();
				user.setSalt(salt);
				user.setPassword(hashedPasswordBase64);
				user.setLoginPjax(true);
				user.setLoginCount(0);
				user.setLoginAt(0);
				user.setDisabled(true);
//				userService.insert(user);
			}
			//设置邀请人
			opo_user ouTemp = new opo_user();
			if(inviId!=null){
                ouTemp = opoUserService.fetch(Cnd.where("uuid","=",inviId));
            }else {
				Subject subject = SecurityUtils.getSubject();
				if (subject != null) {
					Sys_user LoginUser = (Sys_user) subject.getPrincipal();
					if(LoginUser!=null){
						ouTemp = opoUserService.fetch(Cnd.where("uuid","=",LoginUser.getId()));
					}
				}
			}
			if(ouTemp!=null){
				opoUser.setInviter(ouTemp.getReal_name());
				opoUser.setInviter_phone(ouTemp.getPhone());
				ouTemp.setDynamic_wallet(ouTemp.getDynamic_wallet() + 300);
				opoUserService.updateIgnoreNull(ouTemp);
			}
			opoUser.setUser(user);
			// Begin transaction
			Trans.exec(new Atom(){
				public void run() {
					opoUserService._insertWith(opoUser,"user");
				}
			});
			// End transaction
			return Result.success("system.success");
		} catch (Exception e) {
			return Result.error("system.error");
		}
    }

我还没看明白问题是什么.

找到问题了 bootstrap标签的disabled 添加了 就提交不上来 后面换成

                        <fieldset disabled>
                        <div class="form-group">
                            <label for="inviter" class="col-sm-2 control-label">邀请人</label>
                            <div class="col-sm-8">
                            <input type="text" id="inviter" class="form-control" name="inviter"  placeholder="邀请人" >
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inviter_phone" class="col-sm-2 control-label">领导人电话号码</label>
                            <div class="col-sm-8">
                            <input type="text" id="inviter_phone" class="form-control" name="inviter_phone" placeholder="领导人电话号码" >
                            </div>
                        </div>
                        <input type="hidden" id="inviId" class="form-control" name="inviId"  placeholder="邀请人ID">
                        </fieldset>

就是inviter inviter_phone inviId 获取不到值 原因是bootstarp的 disabled标签

添加回复
请先登陆
回到顶部