0
我有一個與美國各州和地區的下拉菜單。我想添加加拿大省份,以便整個列表按照字母順序排列在州/省。卡門鐵路分區域選擇(結合加拿大各省和美國州)
目前我有這樣的代碼,其中列出美國所有州和領地:
= extra_fields.input :province, label: "Franchisee Billing State/Province", input_html: { class: "form-control" } do
= extra_fields.subregion_select(:province, "US", {prompt: 'Please select a state'}, required: 'region required')
我試過subregion_select的第二個參數轉換爲[「美國,‘CA’]但是,打破東西
我不明白其中'label_method :: name,value_method :: code'來了從他們做什麼? – mikeglaz
我希望你使用'simple_form'。 'label_method'和'value_method'帶有'simple_form'。 ''和'value_method'的'lebel_method'爲''。所以如果你的'subregion'的名字是'Alabama'並且代碼是'AL',那麼它就變成''。欲瞭解更多詳情,請檢查你'選擇'字段,並看到他們的'選項'。 –