Skip to content Skip to sidebar Skip to footer

Order Of Selection In Html Select Multiple?

I have a tagging plugin which maintains it's selection of tags in two forms. One is an internal array. The other is by having an html select which only contains the tags with all s

Solution 1:

According to the HTML spec, the form values are to be submitted in the order they appear in the document:

  • application/x-www-form-urlencoded (GET or POST): "The control names/values are listed in the order they appear in the document."
  • multipart/form-data (POST): "The parts are sent to the processing agent in the same order the corresponding controls appear in the document stream."

See http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 for more details.

However, just because that's what the spec says doesn't mean that's what browsers actually do. Browsers are notorious for not following the w3c specs. It's probably safer for you to track the order in a separate <input type="hidden"> element.

Post a Comment for "Order Of Selection In Html Select Multiple?"