0
<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>

不会显示?

谢谢你。

4

1 回答 1

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;
    }
}

在这里查看更多信息。

我想它会对你有所帮助。

于 2013-01-17T09:45:34.523 回答