Skip to content
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

check_box behavior #26

Open
jaysneg opened this issue May 22, 2018 · 5 comments
Open

check_box behavior #26

jaysneg opened this issue May 22, 2018 · 5 comments

Comments

@jaysneg
Copy link

jaysneg commented May 22, 2018

check_box helper did not need unchecked_value
when using multi params it brake request

why do not left default behavior?

== check_box "gender[]", checked_value: gender.name_to_url, checked: params.fetch_all("gender[]").includes?(gender.name_to_url)

and add somthing like this

62   def input_field_new(type : Symbol, **options)
 63     options = options.to_h
 64     options.delete(:checked) unless options[:checked]
 65     input_field_string(type: type, options: options)
 66   end
@faustinoaq
Copy link
Contributor

faustinoaq commented May 22, 2018

@jaysneg Nice idea! @elorest WDYT?

@robacarp
Copy link
Member

@jaysneg what do you mean "when using multi params it breaks the request?" Can you provide a more verbose example of what you're trying to do?

@jaysneg
Copy link
Author

jaysneg commented May 24, 2018

when you have group of checkboxes.

for example search form with list of brands and you want to select a few and send to server

and at server you will get brands => ["adidas", "0" , "Nike"]

so in this case we don't need unchecked_value

if checkbox unchecked server did not get this parameter

@robacarp
Copy link
Member

@jaysneg Great, good example.

Rails uses an option called include_hidden to toggle this behavior, and I think we should follow that pattern. Is that reasonable?

@jaysneg
Copy link
Author

jaysneg commented May 30, 2018

@robacarp sounds great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants