HTML standards for entering names in complex forms

Is there a standard or good practice for selecting the value of the name attribute in complex HTML input elements? For example:

 <input type="text" name="post[comments][0][author][name]" /> 

But what about a few meanings? Should i use

 <input type="file" multiple name="post[attachments]" /> 

or

 <input type="file" multiple name="post[attachments][]" /> 

?

PHP only supports the latter, but W3C uses the former in its examples. Since I am parsing raw multipart/form-data entities, I do not rely on a specific language; I am looking for standards, best practices or suggestions.

+7
source share
2 answers

The HTML5 specification does not define any format or best practices for the contents of the name attribute. It saves only two values isindex and _charset_ .

( UPDATE : HTML5 defines name keywords for the autocomplete attribute .)

For e-commerce forms, there is RFC 3106 : ECML v1.1: field specifications for e-commerce . It defines several keywords that can be used as name values ​​for an input element (in accordance with section 2.2).

Http://wiki.whatwg.org/wiki/Autocomplete_Types explains why this is not a good way to achieve autocomplete functionality:

RFC 3106 requires websites to comply with a set of input naming standards, effectively co-opting for the name attribute, which has other, sometimes conflicting, uses.

+2
source

Is there a standard or good practice for choosing the value of a name attribute in input elements of complex HTML forms?

There are no standards for this.

The syntax that you use in it specifically for the PHP data analyzer (there are several modules for other languages ​​that simulate).

This is a convenient syntax for working with complex data structures in forms.

0
source

All Articles