-
Notifications
You must be signed in to change notification settings - Fork 46
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
Allow address fields to be disabled #974
base: main
Are you sure you want to change the base?
Conversation
.select2-container--default.select2-container--disabled .select2-selection--multiple{ | ||
@apply bg-slate-200 dark:bg-slate-700 hover:bg-slate-200 hover:dark:bg-slate-700 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…up with the same id...
postal_code_options ||= {} | ||
postal_code_options[:data] ||= {} | ||
region_html_options ||= {} | ||
region_html_options[:data] ||= {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to create separate options
hashes for each individual input because if we pass the same hash to each input they all end up with the same id
on the actual input
elements. The duplicate id
thing happens because of this line:
bullet_train-core/bullet_train-themes-light/app/views/themes/light/fields/_field.html.erb
Line 33 in c330e87
options[:id] ||= form.field_id(method) |
This allows you to pass
options: {disabled: true}
to disable the entire address field.Like this:
It disabled every input that's a part of the address, regardless of whether the address has been populated previously.
Empty initial state:
With a previously populated address:
This finally fixes #573