demarches-normaliennes/spec/views/shared/dossiers
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
..
messages Anonymisation de l'instructeur dans la messagerie 2020-05-18 12:56:30 +00:00
_champs.html.haml_spec.rb models: require belong_to associations on champ 2020-08-18 15:57:37 +02:00
_demande.html.haml_spec.rb suppression du message d'alerte suite aux problèmes d'upload 2020-07-27 10:32:03 +02:00
_edit.html.haml_spec.rb views: allow unselecting all values from a multiple dropdown 2020-08-27 11:13:40 +02:00
_identite_entreprise.html.haml_spec.rb affiche infos entreprise uniquement si diffusable 2020-03-17 15:57:02 +00:00