1. <legend id='oaAZ8'><style id='oaAZ8'><dir id='oaAZ8'><q id='oaAZ8'></q></dir></style></legend>

    2. <i id='oaAZ8'><tr id='oaAZ8'><dt id='oaAZ8'><q id='oaAZ8'><span id='oaAZ8'><b id='oaAZ8'><form id='oaAZ8'><ins id='oaAZ8'></ins><ul id='oaAZ8'></ul><sub id='oaAZ8'></sub></form><legend id='oaAZ8'></legend><bdo id='oaAZ8'><pre id='oaAZ8'><center id='oaAZ8'></center></pre></bdo></b><th id='oaAZ8'></th></span></q></dt></tr></i><div id='oaAZ8'><tfoot id='oaAZ8'></tfoot><dl id='oaAZ8'><fieldset id='oaAZ8'></fieldset></dl></div>

      <tfoot id='oaAZ8'></tfoot>
          <bdo id='oaAZ8'></bdo><ul id='oaAZ8'></ul>

        <small id='oaAZ8'></small><noframes id='oaAZ8'>

        如何使用 jquery 验证插件验证名称中带有点的输入

        时间:2023-10-12
          <bdo id='A4mge'></bdo><ul id='A4mge'></ul>

              <tfoot id='A4mge'></tfoot>

                    <tbody id='A4mge'></tbody>

                  <small id='A4mge'></small><noframes id='A4mge'>

                  <legend id='A4mge'><style id='A4mge'><dir id='A4mge'><q id='A4mge'></q></dir></style></legend>

                  <i id='A4mge'><tr id='A4mge'><dt id='A4mge'><q id='A4mge'><span id='A4mge'><b id='A4mge'><form id='A4mge'><ins id='A4mge'></ins><ul id='A4mge'></ul><sub id='A4mge'></sub></form><legend id='A4mge'></legend><bdo id='A4mge'><pre id='A4mge'><center id='A4mge'></center></pre></bdo></b><th id='A4mge'></th></span></q></dt></tr></i><div id='A4mge'><tfoot id='A4mge'></tfoot><dl id='A4mge'><fieldset id='A4mge'></fieldset></dl></div>

                1. 本文介绍了如何使用 jquery 验证插件验证名称中带有点的输入字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 这个 jquery 验证插件

                  <s:textfield cssClass="form-control input-default" name="contest.title" id="title" placeholder="Enter Title"
                                               />
                  

                  验证对此不起作用,但如果我将名称更改为 title - 验证有效.

                  Validation doesn't work for this, but if I change the name to title - validation works.

                  我尝试搜索,但找不到验证名称中带有 . 的字段的方法.

                  I tried searching, but couldn't find a means to validate fields with a . in their name.

                  请帮忙

                  更新

                  脚本

                  <script type="text/javascript">
                              jQuery(document).ready(function() {
                                  jQuery("#contestform").validate({
                                      submitHandler: function(form) {
                  //                        return false;  // block the default submit action
                                      },
                                      rules: {
                                          title: {
                                              required: true
                                          },
                                          link: {
                                              required: true
                                          },
                                          startdt: {
                                              required: true
                                          },
                                          enddt: {
                                              required: true
                                          },
                                          descr: {
                                              required: true
                                          },
                                      },
                                      messages: {
                                          title: "Please enter a title",
                                          link: "Please enter the sponser redirection link",
                                          startdt: "Please select start date",
                                          enddt: "Please select end date",
                                          descr: "Please enter description"
                                      }
                                  });
                              });
                          </script>
                  

                  表格的一部分

                  <form action="" enctype="multipart/form-data" method="post" id="contestform">
                              <s:hidden name="option" value="option"/>
                              <s:hidden name="contest.idcontest"/>
                              <div class="form-group">
                                  <label for="title">Title</label>
                                  <s:textfield cssClass="form-control input-default" name="contest.title" id="title" placeholder="Enter Title"
                                               />
                              </div>
                  

                  推荐答案

                  你需要把字段名放在qoutes中.来自 插件文档

                  You need to put the field names in qoutes. From the plugin documentation

                  名称复杂的字段(括号、点)

                  Fields with complex names (brackets, dots)

                  当你有一个像 user[name] 这样的 name 属性时,确保把引号中的名称.一般准则中的更多详细信息.

                  When you have a name attribute like user[name], make sure to put the name in quotes. More details in the General Guidelines.

                  链接参考中的示例:

                  $("#myform").validate({
                    rules: {
                      // no quoting necessary
                      name: "required",
                      // quoting necessary!
                      "user[email]": "email",
                      // dots need quoting, too!
                      "user.address.street": "required"
                    }
                  });
                  

                  这篇关于如何使用 jquery 验证插件验证名称中带有点的输入字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:struts2 jquery ajax 和客户端验证不能一起工作 下一篇:打开标签的数量限制

                  相关文章

                  最新文章

                2. <i id='ZTZu8'><tr id='ZTZu8'><dt id='ZTZu8'><q id='ZTZu8'><span id='ZTZu8'><b id='ZTZu8'><form id='ZTZu8'><ins id='ZTZu8'></ins><ul id='ZTZu8'></ul><sub id='ZTZu8'></sub></form><legend id='ZTZu8'></legend><bdo id='ZTZu8'><pre id='ZTZu8'><center id='ZTZu8'></center></pre></bdo></b><th id='ZTZu8'></th></span></q></dt></tr></i><div id='ZTZu8'><tfoot id='ZTZu8'></tfoot><dl id='ZTZu8'><fieldset id='ZTZu8'></fieldset></dl></div>
                    <bdo id='ZTZu8'></bdo><ul id='ZTZu8'></ul>
                3. <small id='ZTZu8'></small><noframes id='ZTZu8'>

                    <tfoot id='ZTZu8'></tfoot>
                  1. <legend id='ZTZu8'><style id='ZTZu8'><dir id='ZTZu8'><q id='ZTZu8'></q></dir></style></legend>