Page 87 - CodePilot V5.0 C8
P. 87
Attribute Name Values Description
VALUE Any string value It is used to specify the value of the <INPUT> tag.
NAME Any string value It is used to specify the name of the <INPUT> tag.
CHECKED No value It specifies that an element should be pre-selected.
MAXLENGTH Any positive integer It specifies the maximum number of characters
allowed in an element.
SIZE Any positive integer It specifies the character limit (width) for an element.
ID Any unique string It provides a unique identifier for the <INPUT> tag.
PLACEHOLDER Any string value It allows you to provide a hint or explanatory text.
Adding Text Field
To insert a text field, the TYPE attribute is used along with the value “TEXT” that allows the user
to input text. The syntax to add the text field in the form is as follows:
<INPUT TYPE="TEXT" NAME="Name of the textbox"
SIZE="size of the textbox"
VALUE="default value of textbox"
PLACEHOLDER="The hint for the textbox">
The following code snippet uses the <INPUT> tag with TYPE=“TEXT” attribute to display a text box:
<LABEL FOR="username">User Name:</LABEL>
<INPUT ID="username" TYPE="TEXT" NAME="username" SIZE="30"
PLACEHOLDER="Enter your username">
Scan the QR
The output of the preceding code is as follows: for full code
Adding a Radio Button
Radio Button lets the user select exactly one option from a predefined set of options with the
same name value. Grouping is achieved through a common NAME attribute.
The user can choose only one radio option at a time with the same name. The syntax to add the
radio button in the form is as follows:
<INPUT TYPE="RADIO" NAME="Name of the radio group" VALUE="value of
radio button" CHECKED>
85
Frames and Forms in HTML5

