zurb基础错误消息默认显示?

时间:2013-10-28 08:52:31

标签: forms ruby-on-rails-4 zurb-foundation

我在rails 4应用程序中使用foundation.abide.js,下面是基本代码设置。无论我尝试什么或我google什么,我似乎无法确定为什么默认表单总是显示红色错误消息。关于我失踪的任何想法?

enter image description here

<div class="row">
  <div class="large-12 columns">
    <h2>Abide</h2>
    <h4 class="subheader">Abide is an HTML5 form validation library that supports the native API by using patterns and required attributes.</h4>

    <form class="custom" data-abide>
      <fieldset>
        <legend>Fieldset</legend>

        <div class="row">
          <div class="large-12 columns">
            <label for="password">Password <small>required</small></label>
            <input type="password" id="password" placeholder="LittleW0men." name="password" required>
            <small class="error" data-error-message>Passwords must be at least 8 characters with 1 capital letter, 1 number, and one special character.</small>
          </div>
        </div>

        <div class="row">
          <div class="large-12 columns">
            <label for="phone">Phone</label>
            <input type="tel" id="phone" placeholder="1 234-567-8910">
            <small class="error" data-error-message>Please enter a properly formatted telephone number.</small>
          </div>
        </div>

        <div class="row">
          <div class="large-4 columns">
            <label for="email">Email</label>
            <input type="email" id="email" placeholder="foundation@zurb.com">
            <small class="error">Valid email required.</small>
          </div>
          <div class="large-4 columns">
            <label for="url">URL <small>required</small></label>
            <input type="url" id="url" placeholder="http://zurb.com" required>
            <small class="error" data-error-message>Valid URL required.</small>
          </div>
          <div class="large-4 columns">
            <div class="row collapse">
              <label for="customDropdown1">Hardest to find in grocery <small>required</small></label>
              <select id="customDropdown1" class="medium" required>
                <option value="">Select grocery item</option>
                <option value="first">Green Chilies</option>
                <option value="second">Raisins</option>
                <option value="third">Panko bread crumbs</option>
                <option value="fourth">Assistance</option>
              </select>
              <small class="error" data-error-message>Broke.</small>
            </div>
          </div>
        </div>

        <div class="row">
          <div class="large-12 columns">
            <hr>
          </div>
        </div>

        <div class="row">
          <div class="large-6 columns">
            <label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 1</label>
            <label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 2</label>
            <label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 3</label>
          </div>
          <div class="large-6 columns">
            <label for="checkbox1"><input type="checkbox" id="checkbox1" style="display: none;" required><span class="custom checkbox"></span> Label for Checkbox</label>
            <label for="checkbox2"><input type="checkbox" id="checkbox2" CHECKED style="display: none;" required><span class="custom checkbox checked"></span> Label for Checkbox</label>
            <label for="checkbox3"><input type="checkbox" CHECKED id="checkbox3" style="display: none;" required><span class="custom checkbox checked"></span> Label for Checkbox</label>
          </div>
        </div>

        <div class="row">
          <div class="large-12 columns">
            <hr>
          </div>
        </div>

        <div class="row">
          <div class="large-12 columns">
            <label for="remarks">Closing Remarks</label>
            <textarea id="remarks" name="remarks" placeholder="Leave your remarks here."></textarea>
          </div>
        </div>

        <div class="row">
          <div class="large-12 columns">
            <button type="submit" class="medium button green">Submit</button>
          </div>
        </div>

      </fieldset>
    </form>

  </div>
</div>

1 个答案:

答案 0 :(得分:0)

很难仅通过HTML片段找到问题(看起来不错,所以问题必须在其他地方)。

你确定:

  • 你包含了来自zurb基础框架的所有CSS,并且DID NOT意外地覆盖了一些CSS属性(请与DIV检查员确认默认情况下确实隐藏了'错误'类)
  • 确保您没有在页面加载时尝试发送/验证表单的JS代码段

如果您想要更详细的分析,请将整个内容发布到某处,以便我们可以看到您在那里的完整设置(HTML + CSS + JS)