Wednesday, 30 November 2011

FORMS

Forms are one of the most important tools on a web site because they allow your web users to communicate easily with you. It is also a valuable way for you to obtain information from your web users.

Here is the code for a simple form:


ASP Web Pro







Email:
Namel:






This form would display like this:
Email:
Name:

The tags work just like any other HTML tag. Anytime you open a form with you must close it with a
. Notice that
tag has its own attributes. The NAME attribute is used to assign a name to the form. The METHOD attribute is how the form data will be sent. There are only two types of Methods available, POST or GET. Unless you are a more advanced HTML'er, stick with the POST method. This is what the large majority of web forms use. The ACTION attirbute tells the form which page to go to next after the form is submitted.

Each form field begins with INPUT TYPE which specifies what type of field it is. In this case "text" means it is a basic text field that can hold any kind of data. Notice that each form field also has its own NAME attribute to make each field unique. The SIZE attribute is optional for form field. This specifies the number of characters that can fit in a form field before it begins scrolling over and hiding characters. Finally, the submit button is represented by INPUT TYPE="submit". HTML always recognizes this as a standard submit button. The submit button also has a NAME attribute and has an additional VALUE attribute, which declares what value to display on the submit button.

Ok, you understand how to put together a simple form. Now, you want to add some advanced form elements to it. Like just about everything else in web development, you can customize your forms just about anyway you want. Here are some examples of advanced form elements:
To insert a dropdown list field, you could add this code to your form:




To insert a multi-line memo field, you could add this code to your form:









There you have it. Now, you are ready to start building and customizing your very own tables!

http://www.aspwebpro.com/tutorials/html/forms.asp

No comments:

Post a Comment