-
Notifications
You must be signed in to change notification settings - Fork 351
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
Unwanted hidden input on check_box helper with bootstrap_form_tag #215
Comments
More weird: = f.form_group label: { text: 'Visibility level' } do
- Project.visibility_levels.each do |label, level|
= f.check_box :visibility_levels, name: 'visibility_levels[]', label: label, value: level, checked: params[:visibility_levels].present? && params[:visibility_levels].include?(level.to_s) Produce: <div class="form-group">
<label class="control-label">
Visibility level
</label>
<div class="checkbox">
<label for="_visibility_levels">
<input name="visibility_levels[]" type="hidden" value="0">
<input id="_visibility_levels" name="visibility_levels[]" type="checkbox" value="1">
Private
</label>
</div>
<div class="checkbox">
<label for="_visibility_levels">
<input name="visibility_levels[]" type="hidden" value="0">
<input id="_visibility_levels" name="visibility_levels[]" type="checkbox" value="1">
Internal
</label>
</div>
<div class="checkbox">
<label for="_visibility_levels">
<input name="visibility_levels[]" type="hidden" value="0">
<input id="_visibility_levels" name="visibility_levels[]" type="checkbox" value="1">
Public
</label>
</div>
</div> |
The hidden input is needed. If you remove the hidden field and uncheck the checkbox the value are still true after the save. |
This causes issues in collections. I have a filter which has some checkboxes. If none are checked, it should display every record. But since In Rails 4 with |
@hut8 Nope, this is not working for me. I am still getting hidden field, even after using |
I'm having a hard time finding a clean way to work around this (Google is not giving any answers!). The issue seems to be with: https://github.com/bootstrap-ruby/rails-bootstrap-forms/blob/0fba8444cecdccec3c662de3988cc2d35c3fe2e5/lib/bootstrap_form/form_builder.rb#L168-L174 The
This then ensures the |
Cleaning up old unanswered issues. If this question is still relevant, please reopen. |
Hi, Is there any progress on this? |
I looked at the PR, and it looks good to me. However there is a problem with the "danger" linting, and I am not familiar with it. |
With the following template:
We got this html result for the
with_push
element:The hidden field is unwanted and produce this following url parameters:
That not works.
Is that an issue? How to disable it?
Thanks.
The text was updated successfully, but these errors were encountered: