fae_association not compatible with simple_form's include_blank
Hello,
I have a association pulldown which is optional. I passed the include_blank: true option to the helper, but I still have no way of "deselecting" a value.
Model:
class PlanningDate < ApplicationRecord
# ...
belongs_to :spot, required: false
# ...
end
Form:
fae_association f, :spot, include_blank: true
I see that you use Chosen for these inputs. They have a specific option for this: allow_single_deselect: true
Could you add this option when include_blank: true is passed?
Hi @Spone,
If you pass in a string to include_blank, you will be able to select that option.
Try: fae_association f, :spot, include_blank: 'Select One'
Hope that helps!
Nice one, but now I have twice "Select One" when I create a new record.
Ah! You're right, we are looking into a fix for this, thank you.
@Spone it looks like you can use prompt: 'select one' and it won't generate a duplicate. @jamesmk do you still want to fix include_blank or should we just suggest using prompt in the documentation?
@Spone Fae uses the prompt option to add "Select One" by default which is the method to deselect an option. Is that not happening for you? You can override this message by passing in a custom prompt as @andrewdang17 suggested.
thanks
The "Select One" item is displayed when I'm creating a record:

but it disappears when I'm editing it, so I can no longer unselect:

:+1: @andrewdang17