demarches-normaliennes/app/views/shared/dossiers/editable_champs
Pierre de La Morinerie 0800bf68d0 views: allow unselecting all values from a multiple dropdown
Currently, deselecting all values from a multiple dropdown rendered as
checkboxes doesn't have any effect when submitting the form (the
previous values are still there, instead of being deselected).

This is because unchecked checkboxes are not sent by the browser – so
the "empty selection" never gets sent.

Rails `form.check_box` usually works around this by inserting an empty
hidden checkbox element, that will be sent even if all others are
de-selected. But the documentation warns that this is not possible when
iterating over an array (rather than a model). Which is our case here.

To fix this, this commit uses `collection_check_boxes` instead. It will
insert the proper hidden checkboxes in all cases, and fix our use case.

See https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes
2020-08-27 11:13:40 +02:00
..
_address.html.haml Revert "Revert "Merge pull request #4552 from tchak/champ-communes"" 2020-01-14 18:46:07 +01:00
_carte.html.haml Put IGN map behind a feature flag 2020-07-30 17:22:28 +02:00
_champ_label.html.haml fix heading order by removing useless h4 2020-07-20 11:36:55 +02:00
_champ_label_content.html.haml replace html labels with h2 elements 2020-03-24 16:54:35 +00:00
_checkbox.html.haml editable_champs: move the label near the checkbox 2018-06-18 18:12:11 +02:00
_civilite.html.haml ajout d'un fieldset sur le champ civilité 2020-03-24 16:54:35 +00:00
_communes.html.haml Revert "Revert "Merge pull request #4552 from tchak/champ-communes"" 2020-01-14 18:46:07 +01:00
_date.html.haml date champs: adding a placeholder for IE and Safari (which do not support the input type date) 2020-08-19 14:10:58 +00:00
_datetime.html.haml datetime type de champ: changed the years range from [1950;2100] to [to current year - 1; 2020-08-13 13:41:45 +00:00
_decimal_number.html.haml Add DecimalNumberChamp 2018-11-06 11:28:44 +01:00
_departements.html.haml Revert "Revert "Merge pull request #4552 from tchak/champ-communes"" 2020-01-14 18:46:07 +01:00
_dossier_link.html.haml Fix procedures with multiple dossier link champs 2018-10-24 10:44:28 +02:00
_drop_down_list.html.haml views: add a "None" option to optional radio lists 2020-08-25 11:42:30 +02:00
_editable_champ.html.haml dossiers: allow auto upload of attachments 2020-03-31 13:09:44 +02:00
_email.html.haml editable_champ: move partials path 2018-02-27 18:36:29 +01:00
_engagement.html.haml editable_champ: move partials path 2018-02-27 18:36:29 +01:00
_etablissement_titre.html.haml siret: make etablissement styled and visible 2018-07-30 17:49:00 +02:00
_explication.html.haml [Fix #1801] use the new string_to_html method 2018-05-24 18:05:41 +02:00
_header_section.html.haml form: don't display index if the libelle already starts with a number 2020-02-13 11:21:30 +01:00
_integer_number.html.haml Add IntegerNumberChamp 2018-11-06 11:28:44 +01:00
_linked_drop_down_list.html.haml Store drop_down_list values as jsonb 2020-06-25 13:14:17 +02:00
_multiple_drop_down_list.html.haml views: allow unselecting all values from a multiple dropdown 2020-08-27 11:13:40 +02:00
_number.html.haml editable_champ: move partials path 2018-02-27 18:36:29 +01:00
_pays.html.haml Revert "Revert "Merge pull request #4552 from tchak/champ-communes"" 2020-01-14 18:46:07 +01:00
_phone.html.haml very light client-side validation for phone 2020-08-20 15:33:03 +02:00
_piece_justificative.html.haml views: refactor the attachment/edit view 2019-10-31 10:27:19 +01:00
_regions.html.haml Revert "Revert "Merge pull request #4552 from tchak/champ-communes"" 2020-01-14 18:46:07 +01:00
_repetition.html.haml autosave: remove the repetition row after deletion 2020-08-25 14:39:34 +02:00
_siret.html.haml form: fix the bottom margin of the siret element 2020-02-11 17:36:50 +01:00
_text.html.haml Use aria-describedby to link notice and input again 2019-11-21 15:34:59 +01:00
_textarea.html.haml minor typo in textareas 2019-12-03 10:13:16 +01:00
_yes_no.html.haml ajout d'un fieldset sur le champ civilité 2020-03-24 16:54:35 +00:00