【问题标题】:Rails Gem Client Side Validations html structRails Gem 客户端验证 html 结构
【发布时间】:2012-04-07 08:54:42
【问题描述】:

我的项目使用 Twitter Bootstrap CSS 框架,所以我的 html 是这样的。

<div class="control-group ">
  <label class="control-label" for="user_name">Username</label> 
  <div class="controls">
    <input data-validate="true" id="user_name" name="user[name]" size="30" type="text">
  </div>
</div>

当验证失败时,客户端验证将其更改为:

<div class="control-group ">
  <div class="field_with_errors">
    <label class="control-label" for="user_name">Username</label>
  </div> 
  <div class="controls">
    <div class="field_with_errors">
      <input data-validate="true" id="user_name" name="user[name]" size="30" type="text">
      <label for="user_name" class="message">Please input Username</label>
    </div>
  </div>
</div>

但我想使用 Bootstrap 表单验证 Css: html是:

<div class="control-group error">
   <label class="control-label" for="inputError">Input with error</label>
   <div class="controls">
      <input type="text" id="inputError">
         <span class="help-inline">Please correct the error</span>
      </div>
   </div>
</div>

怎么办?

【问题讨论】:

    标签: javascript ruby-on-rails-3 rubygems gem client-side


    【解决方案1】:

    试试这个宝石:realtime validations

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多