开发者

HOWTO: Rails show suggestion message if form submitted but value incorrect

开发者 https://www.devze.com 2023-03-24 14:40 出处:网络
开发者_运维知识库<div class=\"field\"> <%= f.label :name %><br/> <span style=\"color:red;font-weight: normal; font-size:11px; \"><%= errors_for(:name, @user) %> </span
开发者_运维知识库<div class="field">
  <%= f.label :name %><br/>
  <span style="color:red;font-weight: normal; font-size:11px; "><%= errors_for(:name, @user) %> </span>
  <%= f.text_field :name, :class => "login", :placeholder => "Your Name" %>      
</div>

I have an input like the above and I need the below to happen if the form is submitted but the value entered is wrong (e.g no @ sign in the email or the password does not match the verification) :

HOWTO: Rails show suggestion message if form submitted but value incorrect

How can I get this small message to appear next to the incorrect field?


You can use client_side_validations gem for that.

0

精彩评论

暂无评论...
验证码 换一张
取 消