Does the DOM order determine the order of published form parameters?

If I have a form like this:

<form>
  <input name="param[]" />
  <input name="param[]" />
  <input name="param[]" />
</form>

Can we expect to receive these parameters in the same order when the form is submitted?

I noticed that Chrome, Rails, and Webrat maintain the order of the parameters, but this may be due to implementation details, and not compliance with the standard.

+4
source share
1 answer

This is the standard . I find the W3C specification very useful and readable.

application / x-www-form-urlencoded ...

The control names / values ​​are listed in the order in which they appear in the document.

multi-part / form data ...

, .

, , , .

, , . , :

<form>
  <input name="param[0]" />
  <input name="param[1]" />
  <input name="param[2]" />
</form>
+10

All Articles