-
-
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
Using semantic_form_for inputs in a sidebar partial double-renders inputs on resource show page #3613
Comments
try this: - f.input :market, collection: Market.for_select |
Yeah, that does fix it. |
Wait, should this be closed? Even though the double-output can be eliminated by switching from the echoing "=" to the non-echoing "-", formtastic works fine everywhere else with the echoing "=". In fact, that's how formtastic's documentation guides you to use it: https://github.com/justinfrench/formtastic#usage It seems like this shouldn't be a problem in the first place. |
Interesting development: It happens on the show page for a resource, but not on the index or edit pages. I added this partial as a sidebar to the Store admin resource inside the test-rails-app application.
Screenshot of the show page: https://www.dropbox.com/s/pe41ayd8q3e2mcg/Screenshot%202014-11-15%2021.51.25.png?dl=0 |
It's somehow related to active_admin_comments_for. If that renders on the same show page, then it doubles the sidebar form input. If it isn't on the page, then the sidebar form input is displayed correctly. |
Somehow active_admin_form_for being used in the show resource is causing the problem. It's important to note that you have to have to call
So it's happening consistently on the show page because the Comments module uses active_admin_form_for |
Could this be related to #3486 ? |
I'm having the same issue - and had to revert to using the non-arbre style. Converting to the included arbre-style of forms within AA exposes this issue on my codebase. form do |f|
f.semantic_errors(*f.object.errors.keys)
f.inputs I18n.t('activerecord.models.customer', count: 1) do
f.input :name, input_html: { autofocus: true }
f.input :email, as: :email
f.input :mobile_no, as: :phone
f.semantic_fields_for :customer_meta, f.object.customer_meta || f.object.build_customer_meta do |fi|
fi.input :alternate_no, as: :phone
end
end
f.actions
end This(^^^) works; while this(vvv) does not: form do |f|
semantic_errors(*f.object.errors.keys)
inputs I18n.t('activerecord.models.customer', count: 1) do
input :name, input_html: { autofocus: true }
input :email, as: :email
input :mobile_no, as: :phone
semantic_fields_for :customer_meta, f.object.customer_meta || f.object.build_customer_meta do |fi|
input :alternate_no, as: :phone
end
end
actions
end |
I upgraded to a new version of AA, and a sidebar partial that I had written quite some time ago started showing its inputs doubled. I had another sidebar partial that was using plain form_tag that worked fine. I adapted the semantic_form_for version to not use the
f.input
calls and instead use the standard Rails form methods and it fixed the issue.To be specific, I converted
to
Making this change fixed the problem.
To be clear, I am still using semantic_form_for in my partial; I just stopped using Formtastic's
f.input
helpers.I think something changed in the past few weeks to cause this issue. Hopefully that's enough for you to go on, because I don't have time right now to dig into it.
The text was updated successfully, but these errors were encountered: