Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input field name starts with a number

Tags:

I have an input field whose name is an MD5 string e.g.:

<input type="hidden" name="7815696ecbf1c96e6894b779456d330e" value="1">

Now I understand that having a number as the first letter in an input field name is generally bad practice, but are there any side-effects to this such as a certain browser won't send it in the POST request?

like image 532
fire Avatar asked Mar 18 '10 11:03

fire


People also ask

What is the input type for numbers?

The <input type="number"> defines a field for entering a number. Use the following attributes to specify restrictions: max - specifies the maximum value allowed.

How do you make an input field only accept numbers?

You can use the <input> tag with attribute type='number'. This input field allows only numerical values. You can also specify the minimum value and maximum value that should be accepted by this field.


2 Answers

An ID attribute would have had to begin with a letter as per the HTML 4.01 W3C specification, however since the NAME attribute of input elements is of CDATA type (Source), this restriction does not apply.

One real restriction you get on NAME attributes is when you submit a form with the GET method, because in this case, form data must be restricted to ASCII codes (Source).

like image 178
Daniel Vassallo Avatar answered Nov 04 '22 05:11

Daniel Vassallo


The HTML spec doesn't restrict the control name in any way. In fact it even says that the control name is URL-encoded and that spaces and non-alphanumeric characters are handled in a certain way, so obviously the designers anticipated names having an arbitrary format.

like image 26
Willis Blackburn Avatar answered Nov 04 '22 05:11

Willis Blackburn