Browse files

docs, `select` and friends with `multiple=true` include a blank string.

[Jonas Baumann & Yves Senn]

The submitted params from a select with `multiple: true` look as follows:

```
{post: {category: [""]}}

{post: {category: ["", "Category 1", "Category 2"]}}
```

This is a follow up to #1552.
  • Loading branch information...
1 parent 5d2b1e9 commit e8709aef56d46c9b597af05ebd847309231a888c @senny senny committed Jul 17, 2014
Showing with 3 additions and 5 deletions.
  1. +3 −5 actionview/lib/action_view/helpers/form_options_helper.rb
View
8 actionview/lib/action_view/helpers/form_options_helper.rb
@@ -152,11 +152,9 @@ module FormOptionsHelper
# To prevent this the helper generates an auxiliary hidden field before
# every multiple select. The hidden field has the same name as multiple select and blank value.
#
- # This way, the client either sends only the hidden field (representing
- # the deselected multiple select box), or both fields. Since the HTML specification
- # says key/value pairs have to be sent in the same order they appear in the
- # form, and parameters extraction gets the last occurrence of any repeated
- # key in the query string, that works for ordinary forms.
+ # <b>Note:</b> The client either sends only the hidden field (representing
+ # the deselected multiple select box), or both fields. This means that the resulting array
+ # always contains a blank string.
#
# In case if you don't want the helper to generate this hidden field you can specify
# <tt>include_hidden: false</tt> option.

0 comments on commit e8709ae

Please sign in to comment.