The general syntax for all text boxes is:
where type specifies the type of the input field and name is an optional parameter, specifying the name of the element for further references.
The syntax for specifying the text field is:
This will create an input field like this:
The attribute size specifies the length of the input field in characters. For example,
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:
The attribute value specifies the initial text in the input field after downloading the form into the browser:
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 form | HTML code |
---|---|
<form method="post" action="/cgi-bin/sb/CheckData"> <input name="f1" type="text" /> <p> <input type="submit" /> <input type="reset" /> </form> |
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:
This will create an password field like this:
The remaining attributes play the same role as for the text field. Try how it works:
Input form | HTML code |
---|---|
<form method="post" action="/cgi-bin/sb/CheckData"> <input name="pass" type="password" /> <p> <input type="submit" /> <input type="reset" /> </form> |