浏览器在GET / POST时保持输入名称是否相同? [英] Do browsers preserve order of inputs with same name on GET/POST?

查看:127
本文介绍了浏览器在GET / POST时保持输入名称是否相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个HTML代码,多个输入同名:

I have this HTML code with multiple inputs with the same name:

<input type="hidden" value="42" name="authors" />
<input type="hidden" value="13" name="authors" />
<input type="hidden" value="33" name="authors" />

值的顺序很重要。 HTML规范是否定义用户代理必须保留此顺序,如果是,普通(市场份额> 1%)浏览器是否遵循此定义?

The order of the values is important. Does the HTML spec define that user agents have to preserve this order, and if yes, do the common (market share > 1%) browsers follow this definition?

如果有人知道WSGI,尤其是Django保留订单服务器端: - )

Bonus points if someone knows if WSGI and especially Django preserve the order server-side :-)

谢谢!

推荐答案

是的,他们应该按照 html rfc

请参阅8.2.1。格式编码的媒体类型:

See 8.2.1. The form-urlencoded Media Type:


字段按文档中显示的顺序列出,其中
名称值 ='
,并且每个
&'分隔开的对。具有空值
的字段可以省略。特别是,
unselected单选按钮和
复选框不应出现在
编码数据,但隐藏字段与
VALUE属性存在应该。

The fields are listed in the order they appear in the document with the name separated from the value by =' and the pairs separated from each other by&'. Fields with null values may be omitted. In particular, unselected radio buttons and checkboxes should not appear in the encoded data, but hidden fields with VALUE attributes present should.

我在规范中找到 html 4.0

对于网址编码数据:


控制名称/值列在
中它们在文档中出现的顺序。
名称通过 ='与值
分隔,并且名称/值对是
,通过
和amp;'彼此分隔。

The control names/values are listed in the order they appear in the document. The name is separated from the value by =' and name/value pairs are separated from each other by&'.

对于多部分数据(感谢@Chuck):

For multipart data (thanks @Chuck):


multipart / form-data消息
包含一系列部分,每个
表示成功的控件。
部分以相同的顺序发送到处理代理
,相应的
控制出现在文档
流中。部分边界不应该在任何数据中出现
;这是
是如何在这个
规范的范围之外。

A "multipart/form-data" message contains a series of parts, each representing a successful control. The parts are sent to the processing agent in the same order the corresponding controls appear in the document stream. Part boundaries should not occur in any of the data; how this is done lies outside the scope of this specification.

这篇关于浏览器在GET / POST时保持输入名称是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆