-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form DSL support for formtastic's semantic_errors method #905
Conversation
Form DSL support for formtastic's semantic_errors method
Thanks! |
I'm having issues with the last form buffer being clobbered when there are no errors. The following works fine when there are validation errors, but is missing the two boolean inputs if there are none (i.e. when you go to the edit screen). form.inputs :name => "Has Cars", :class => "as_inline_form" do
form.input :has_auto, :as => :boolean
form.input :has_manual, :as => :boolean
# this is clobbering the previous two elements when there are no errors
form.semantic_errors :base
end UPDATE: This appears to be a formtastic issue as it's happening in regular partials as well. |
Hello pietschy some time ago I opened an issue on inputs inline #1098 was - it was closed by pcreux, it seems that you got it form.inputs :name => "Has Cars", :class => "as_inline_form" to show how you could do? Responding to Set an easy way to put inline input fields open for me? PS. Sorry, but I'm not good at css design and application refers to AA, ok?! |
I just wanted to make a note that when using the current version (f67be37) of master branch to display I use the code like: form do |f|
f.has_many :object do |object_form|
object_form.semantic_errors :base
object_form.input :color
end
end This seemed like the most appropriate place to make the comment rather than creating another issue. |
Document the semantic_errors ability added in Pull request activeadmin#905 activeadmin#905
Document the semantic_errors ability added in Pull request activeadmin#905 activeadmin#905
Per formtastic docs [semantic_errors]:
Generates an unordered list of error messages on the base object and optionally for a given set of named attribute. This is idea for rendering a block of error messages at the top of the form for hidden/special/virtual attributes (the Paperclip Rails plugin does this), or errors on the base model.
A semantic_errors passthrough method was added to the ActiveAdmin::FormBuilder DSL, as well as basic CSS for display of the error messages.
Errors can be displayed at the top of the form by including the semantic_errors method. To display all model errors:
This is particularly useful when you have missing required nested attributes, for which no inline error messages are displayed: