diff --git a/website/content/components/checkbox-group.md b/website/content/components/checkbox-group.md index 63a232027..caea51480 100644 --- a/website/content/components/checkbox-group.md +++ b/website/content/components/checkbox-group.md @@ -44,7 +44,7 @@ The components we provide use wrap checkbox groups in a fieldset. In this contex When using with Rails we recommend using the form builder method provided by `CitizensAdviceComponents::FormBuilder`. ```rb -cads_collection_checkboxes(attribute, collection:, value_method:, text_method:, options = {}) +cads_collection_checkboxes(attribute, collection, value_method, text_method, options = {}, html_options = {}) ``` The method works similarly to the default [`collection_checkboxes` helper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_checkboxes). @@ -53,15 +53,15 @@ The method works similarly to the default [`collection_checkboxes` helper](https <%%= form_with model: @model, url: "/" do |form| %> <%%= form.cads_collection_checkboxes( :example, - collection: [ + [ ["option_1", "Option 1"], ["option_2", "Option 2"], ["option_3", "Option 3"], ["option_4", "Option 4"], ["option_5", "Option 5"], ], - text_method: :first, - value_method: :last, + :first, + :last, hint: "Example hint text", required: true ) %> @@ -74,16 +74,14 @@ But this can also work with any collection: <%%= form_with model: @model, url: "/" do |form| %> <%%= form.cads_collection_checkboxes( :example, - collection: Locations.all, - text_method: :id, - value_method: :name, + Locations.all, + :id, + :name, hint: "Example hint text" ) %> <%% end %> ``` -The `:value_method` and `:text_method` parameters are methods to be called on each member of `collection`. The return values are used as the value attribute and contents of each checkbox. - The method accepts an `options` hash with the following optional parameters: - `:label` - The text for the label associated with the input. Defaults to using translations. diff --git a/website/content/components/radio-group.md b/website/content/components/radio-group.md index abd79cb0d..1b842ec2d 100644 --- a/website/content/components/radio-group.md +++ b/website/content/components/radio-group.md @@ -56,7 +56,7 @@ The components we provide use wrap radio groups in a fieldset. In this context t When using with Rails we recommend using the form builder method provided by `CitizensAdviceComponents::FormBuilder`. ```rb -cads_collection_radio_buttons(attribute, collection:, value_method:, text_method:, options = {}) +cads_collection_radio_buttons(attribute, collection, value_method, text_method, options = {}, html_options = {}) ``` The method works similarly to the default [`collection_radio_buttons` helper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_radio_buttons). @@ -65,15 +65,15 @@ The method works similarly to the default [`collection_radio_buttons` helper](ht <%%= form_with model: @model, url: "/" do |form| %> <%%= form.cads_collection_radio_buttons( :example, - collection: [ + [ ["option_1", "Option 1"], ["option_2", "Option 2"], ["option_3", "Option 3"], ["option_4", "Option 4"], ["option_5", "Option 5"], ], - text_method: :first, - value_method: :last, + :id, + :name, hint: "Example hint text", required: true ) %> @@ -86,16 +86,14 @@ But this can also work with any collection: <%%= form_with model: @model, url: "/" do |form| %> <%%= form.cads_collection_radio_buttons( :example, - collection: Locations.all, - text_method: :id, - value_method: :name, + Locations.all, + :id, + :name, hint: "Example hint text" ) %> <%% end %> ``` -The `:value_method` and `:text_method` parameters are methods to be called on each member of `collection`. The return values are used as the value attribute and contents of each `