Working with text boxes

The general syntax for all text boxes is:

<input type="type" name="name" />

where type specifies the type of the input field and name is an optional parameter, specifying the name of the element for further references.

Creating text field

The syntax for specifying the text field is:

<input type="text" name="name" size="value" maxlength="value" value="value" />

This will create an input field like this:

input type="text"

The attribute size specifies the length of the input field in characters. For example,

size="10"
size="20"

The attribute maxlength specifies maximum number of characters to be put in the text field. You won't be able to enter more than 5 characters into the next field:

size="20" maxlength="5"

The attribute value specifies the initial text in the input field after downloading the form into the browser:

value="abcd"

Putting all together, here is a complete working example of the input text field. You can enter some text into the field, click on the "Submit" button and check the result of this form processing by the server.

Input formHTML code

   

<form method="post" action="/cgi-bin/sb/CheckData">
<input name="f1" type="text" /> 
<p> <input type="submit" /> <input type="reset" />
</form>




Creating password field

This field is intended for entering "secret" data such as passwords. The text in the field will be replaced by asterisks (*). The syntax for specifying the password field is:

<input type="password" size="value" maxlength="value" value="value" />

This will create an password field like this:

input type="password"

The remaining attributes play the same role as for the text field. Try how it works:

Input formHTML code

   

<form method="post" action="/cgi-bin/sb/CheckData">
<input name="pass" type="password" /> 
<p> <input type="submit" /> <input type="reset" />
</form>