表单提交jquery之前的对话框

时间:2014-05-20 01:22:16

标签: jquery modal-dialog messagebox

我有一个表单,我只想要一个简单的jquery消息框,在提交和确认提交之前显示所有用户输入。我是jquery的新手。任何帮助都非常感谢。谢谢。这是我的表格。

       <form role="form" id="form-field" action="inc/Controller/OperatorController.php" method="post"  enctype="multipart/form-data" onsubmit="return validateForm();">

              <div class="form-group">
              <label>Last Name</label><span class="label label-danger">*required</span>
              <input class="form-control" placeholder="Enter Last Name" name="lastname" id="lastname">
            </div>

            <div class="form-group">
              <label>First Name</label><span class="label label-danger">*required</span>
              <input class="form-control" placeholder="Enter First Name" name="firstname" id="firstname">
            </div>

            <div class="form-group">
              <label>Address</label>
            </div>

            <input type="submit" name="btn" value="Submit" id="submit" class="btn btn-default"/>
            <input type="button" name="btn" value="Reset" onclick="window.location='fillup.php'" class="btn btn-default"/>
      </form>

1 个答案:

答案 0 :(得分:0)

http://codepen.io/anon/pen/Imkhy

此代码段循环显示您收集标签的html和输入值的表单。它将它放入一个字符串中,并在窗口显示脚本收集的数据时要求确认。

如果确认,表单会提交,否则,表单提交将被阻止,允许用户编辑内容。

我在您的for元素中添加了<label>属性。永远不要忘记添加for属性! for将标签链接到您的输入,这使开发人员和用户更容易。

相关问题