0

I've researched this and not found this particular question answered -- I'm not asking specifically about form fillers but, for example, building a simple web page.

Is there a standardized list of input name attributes that will address all the possible options someone could put into their code?

This is an example:

<input type="radio" name="mobydick" />thewhale
<input type="radio" name="mobydick" />ahab

Thanks for your help!

Terry
  • 63,248
  • 15
  • 96
  • 118
heymiami
  • 37
  • 1
  • 6
  • You can use anything for the `name` attribute. However, most try to keep it legible, concise and understandable, like `name="email"`, `name="firstname"` and the likes. Using `name="q23fj482"` probably isn't too helpful, for example. – Terry Dec 23 '14 at 19:35
  • Not sure what you are looking for, maybe this list can help you: http://www.w3.org/wiki/HTML/Elements/input – chrki Dec 23 '14 at 19:39
  • "thewhale" and "ahab" should be inside ` – danielnixon Dec 23 '14 at 23:49
  • Thank you all for your responses -- this is exactly the information I was looking for. – heymiami Dec 25 '14 at 08:32

2 Answers2

1

You can use anything for the name attribute. The only restriction would be that you would want to choose something that's clear and easy for you to work with later down the road.

Or if you were looking for a list of html form attributes, check out the following:

http://www.w3schools.com/html/html_form_attributes.asp

user4386709
  • 111
  • 4
0

According to the HTML5 specification, and in browser practice, the name attribute of an input element may have any nonempty string as its value, except that the values _charset_ and isindex have special predefined meanings.

Server-side techniques used may impose their own restrictions and implications on the names.

There are no standards on form field names. However, there were definitions of names that might be regarded as recommended names in HTML5 drafts. Although they were removed from the approved HTML5 specification due to lack of implementations, they have been retained in HTML 5.1 drafts, see clause on autofill in HTML 5.1 Nightly. The idea is that if different sites use the same names for commonly needed field types, browsers can autofill forms. E.g., after filling in your name, postal address, and date of birth on one page, your browser could automatically fill them in when you visit a page that asks for them, using the same names. Of course, such features come with risks, too.

Thus, you may, at your discretion, use the names suggested there. They partly reflect common practices, such as using email for an e-mail address field and tel for a phone number field; partly they are just ideas of what might become “standard”.

Yet another aspect is that if you use the GET method, the names will become visible to users in browser’s address bar after form submission. You might therefore wish to use descriptive names or, as the case may be, obfuscated names, depending on whether you want to make it easier to users to see what’s happening.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390