Reputation: 10412
Is there a way to have different value for label in select box in Simple Form with custom Collection?
Below is an example that I have:
= f.input :hall_type, collection: ["Main", "Exhibition", "Conference", {"KnowedgeLibrary" => "Knowedge Library"}], prompt: "Choose a hall type"
I want KnowledgeLibrary
to be value and Knowledge Library
to be the label/text of the option
Upvotes: 0
Views: 1411
Reputation: 15781
here is the syntax
:collection => [['label1', 'value1'], ['label2', 'value2']]
Upvotes: 1
Reputation: 1072
= f.select :hall_type, options_for_select(["Main", "Exhibition", "Conference", ["Knowedge Library", "KnowedgeLibrary"]], "KnowedgeLibrary"), {prompt: "Choose a hall type"}
Upvotes: 0