Appendix L Introduction to XHTML: (Web design online) Part 2 1465

Appendix L Introduction to XHTML: Part 2 1465 form data directly to the end of the URL. For example, the URL /cgi-bin/formmail might have the form information name=bob appended to it. The action attribute in the

tag specifies the URL of a script on the Web server; in this case, it specifies a script that e-mails form data to an address. Most Internet Service Providers (ISPs) have a script like this on their site; ask the Web-site system administrator how to set up an XHTML document to use the script correctly. Lines 29 36 define three input elements that specify data to provide to the script that processes the form (also called the form handler). These three input element have type attribute “hidden”, which allows the document author to send form data that is not entered by a user to a script. The three hidden inputs are an e-mail address to which the data will be sent, the email s subject line and a URL where the browser will be redirected after submitting the form. Two other input attributes are name, which identifies the input element, and value, which provides the value that will be sent (or posted) to the Web server. Good Programming Practice L.1 Place hidden input elements at the beginning of a form, immediately after the opening
tag. This placement allows document authors to locate hidden input elements quickly. We introduce another typeof input in lines 38 39. The “text” input inserts a text box into the form. Users can type data in text boxes. The label element (lines 37 40) provides users with information about the input element s purpose. Common Programming Error L.2 Forgetting to include a label element for each form element is a design error. Without these labels, users cannot determine the purpose of individual form elements. The input element s size attribute specifies the number of characters visible in the text box. Optional attribute maxlength limits the number of characters input into the text box. In this case, the user is not permitted to type more than 30characters into the text box. There are two types of input elements in lines 52 56. The “submit” input element is a button. When the user presses a “submit” button, the browser sends the data in the form to the Web server for processing. The value attribute sets the text displayed on the button (the default value is Submit). The “reset” input element allows a user to reset all form elements to their default values. The value attribute of the “reset” input element sets the text displayed on the button (the default value is Reset). L.5 More Complex XHTML Forms In the previous section, we introduced basic forms. In this section, we introduce elements and attributes for creating more complex forms. Figure L.4 contains a form that solicits user feedback about a Web site. The textarea element (lines 42 44) inserts a multiline text box, called a textarea, into the form. The number of rows is specified with the rows attribute and the number of columns (i.e., characters) is specified with the cols attribute. In this example, the textarea is four rows high and 36 characters wide. To display default text in the text area, place the text between the tags. Default text can be specified in other input types, such as textboxes, by using the value attribute.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Leave a Reply