I love the new .error_notification feature in simple_form, but I have no idea how to include my recaptcha in it. The code I have looks like:
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, :required => true, :autofocus => true %>
<%= f.input :password, :required => true %>
<%= recaptcha_tags %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up" %>
</div>
<% end %>
I imagine I need to somehow tell simple_form something more about the recaptcha but I can't find much information about .error_notification.
Thanks for any help!
In controller:
unless verify_recaptcha
@captcha_error="Word verification response is incorrect"
end
In view:
<%= recaptcha_tags %>
<span class="help-block pull-left" style="color:#a94442;"><%=@captcha_error%></span>
You can use variable to show your error message.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.