-
Notifications
You must be signed in to change notification settings - Fork 22.1k
add selected and disabled options to grouped select #5083
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
Conversation
add selected and disabled options to grouped select
|
Setting the selected option always makes the group select default to the first available option for me given the following code for simple_form: |
|
@12eebok As far I remember this fix is only in the master branch. |
|
@rafaelfranca You sure? Setting disabled seems to work just fine for me, I'm just having trouble with the selected option. |
|
I'm not sure, maybe this is a SimpleForm issue. have you tried the plain |
|
The form_for equivalent: Produces exactly identical output with my default option being Zabul(first option in the collection) in both cases: <select name="school[state_or_province]" id="school_state_or_province" class="grouped_select optional">
....
<optgroup label="Afghanistan">
<option value="15">Zabul</option>
...Expected output given a key value of 448: <optgroup label="Canada">
<option selected="selected" value="448">Manitoba</option>
...Unless I'm not passing the selected option correctly I don't think it's a simple_form issue. |
|
Yes, this fixes is only to master. |
|
Here the relevant code https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_view/helpers/form_options_helper.rb#L606 see the last argument of the |
|
Good to know, thank you for your time |
|
If you want you can make a pull request with the tests in this one and you implementation (since the master branch and the 3-2-stable are very different in these helpers). I could make it, but I don't have time now |
|
I'd be willing to give it a shot, but I'm still a little green to Github and even Rails for that matter so I'll have to do a little reading first. |
No description provided.