<form id="form_save_account" action="." method="post">
<div style="display:none"><input type="hidden" name="csrfmiddlewaretoken" value="618376f08ab0b6f255442d9519ec656a" /></div>
<div class="container" />
<div class="row" />
<div class="span5" />
<div class="id_account_owner-control-group control-group required">
<label class="control-label" for="id_account_owner"> account owner </label>
<div class="controls">
<input id="id_account_owner" type="text" name="account_owner" maxlength="250" />
</div>
</div>
<div class="id_account_number-control-group control-group required">
<label class="control-label" for="id_account_number"> account number </label>
<div class="controls">
<input id="id_account_number" type="text" name="account_number" maxlength="34" />
</div>
</div>
<div class="span1 offset10">
<a type="submit" name"save-continue-to-review" data-toggle="modal" data-target="#dialog" href="" class="btn primary btn-primary" title="Go">Go
</a>
</div>
</form
<script>
...
</script>
如何创建这样的东西:
如果用户没有在此对话框模式的输入中键入所有数据:
<a type="submit" name"save-continue-to-review" data-toggle="modal" data-target="#dialog" href="" class="btn primary btn-primary" title="Go">Go
</a>
将不会显示?
谢谢。
答案 0 :(得分:1)
我认为您需要在提交时对所有输入字段进行客户端验证 在提交时添加 onclick 事件。例如:
<a type="submit" onclick="javascript:yourFunctionName();" name"save-continue-to-review" data-toggle="modal" data-target="#dialog" href="" class="btn primary btn-primary" title="Go">Go
并在JS文件中将函数定义为:
function yourFunctionName(){
var account_owner = document.getElementById(id_account_owner).value;
var account_no = document.getElementById(id_account_number).value;
if(account_no == '' || account_owner == ''){
return false;
}
}
查看here了解详情。
我认为它会对你有所帮助。