How to create fields of forms

How to create fields of forms

The special program (script) is engaged in processing of data which visitors send to the server after filling of web forms. Therefore it makes sense to add the field to the form placed on the Internet page only if in a script functions of work with this field are programmed. If this condition is met, it will be necessary to do rather simple part of work on adding in the source code of the page of the tags forming the necessary fields.

It is required to you

  • Basic knowledge of the HTML language.


1.  The editor of pages can undertake operation on forming of necessary tags if you have an opportunity to use in it the mode of visual editing. Such editor can be a component of a management system of the website — enter it and load the page with a form to which it is necessary to add new fields. Use operations of copying and an insert — select and copy couple of existing elements (data entry field and the text compared to it), then click the place where it is necessary to place an additional field on the page, and insert copied.

2. After that edit properties of each element of couple separately. Just select an inscription with a mouse and type the new text, and for the data entry field use the button in the editor's panel opening its properties. In properties you, at least, should change value in the field of name - it should correspond to the name of the field programmed in the processing script. Repeat a copying/insert for a necessary set of fields and save the page.

3. If there is no access to visual editing, open the source code of the page in any text or specialized editor and add in it the necessary tags. This way requires some knowledge of the HTML language and methods of imposition of web pages. For adding in a form of a simple text box use the input tag, having entered text value in the type attribute. Except this attribute only name is obligatory - it should contain a name of this field of a form known to a script processor. By means of other attributes it is possible to set the number of the signs which are visually determining input field length (size attribute), the maximum valid quantity of signs (maxlength), parameters of style of design (style), belonging to a slass (class), etc. This tag in the code, for example, so can look: <input type= "" text"" size= "" 150" of" class= "" simField" of" maxlength= "" 200" of" name= "" fName""/>

4. For the field of the multiline text use the textarea tag. It consists of two parts - opening and closing. In the first it is necessary to set name value, and by means of the rows and cols attributes it is possible to set quantity of lines and columns of this element of a form. For example: <textarea name= "" mulField"" cols= "" 200" of" rows= "" 10""> </textarea>

5. Checkboxes can be other types of fields of a form - for their forming use the input tag too, but unlike a single-line text box specify checkbox value in the type attribute. If this element of a form should be noted, add the checked attribute to its tag. For example: <input type= "" checkbox"" name= "" cBox" of" checked= "" checked""/>

6. For an insert in a form of the field of the choice and loading of the file use the same input tag with file value in the type attribute. For example: <input type= "" file"" name= "" fSelect""/>

7. More difficult design forms the field with a drop-down list. It shall contain couple from the opening and closing tags of select. Between them place couples of tags option, each of which sets one line of the choice. At opening tags there has to be a value attribute (its value will be transferred to the server), and between the opening and closing parts place the text which will be seen in this line of the list by the visitor. For example: <select name= "" ddList""> <option id= "" 0"" row1 value= """"> the First line of the choice </option> <option id= "" 1"" row2 value= """"> the Second line of the choice </option> <option id= "" 2"" row3 value= """"> the Third line of the choice </option> </select>

Author: «MirrorInfo» Dream Team