< Day Day Up > |
Before presenting all the form fields, it's important to understand the issues surrounding the name and id attributes. Both of these attributes are used to name the <form> tag itself and the individual fields within it. Traditionally, only the name attribute was supported and was used both for the name-value pairs submitted to the server as well as for scripting. With HTML 4 and XHTML, the id attribute is also used. The main duty of id is for CSS and JavaScript usage, while name is used for both server-side programming and JavaScript. Given the overlap, page authors often set name and id to the same value where possible. In most cases, they are exactly the same but there are some troubling inconsistencies. For example, for fields such as check boxes and radio buttons , the values may actually have to be different. This important difference will be presented in detail when those fields are discussed.
Note | Interestingly enough, under the strict variant of XHTML, the attribute name on the form element is deprecated, but current browser support suggests to ignore the validation error as the form may not be scriptable under some browsers without name . |
< Day Day Up > |