HTML FORMS (FORMATTING AND ATTRIBUTES) - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript HTML FORMS (FORMATTING AND ATTRIBUTES) - Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Wednesday, December 12, 2018

HTML FORMS (FORMATTING AND ATTRIBUTES)

 FORMS 

(FORMATTING AND ATTRIBUTES)



HTML Forms are required, when you want to collect some data from the site visitor. For example, during user registration you would like to collect information such as name, email address, credit card, etc.
A form will take input from the site visitor and then will post it to a back-end application such as CGI, ASP Script or PHP script etc. The back-end application will perform required processing on the passed data based on defined business logic inside the application.
There are various form elements available like text fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.

The HTML <form> tag is used to create an HTML form and it has following syntax −
<form action = "Script URL" method = "GET|POST">
   form elements like input, textarea etc.
</form>

Apart from common attributes, following is a list of the most frequently used form attributes −


Sr.NoAttribute & Description
1
action
Backend script ready to process your passed data.
2
method
Method to be used to upload data. The most frequently used are GET and POST methods.
3
target
Specify the target window or frame where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.
4
enctype
You can use the enctype attribute to specify how the browser encodes the data before it sends it to the server. Possible values are −
application/x-www-form-urlencoded − This is the standard method most forms use in simple scenarios.
mutlipart/form-data − This is used when you want to upload binary data in the form of files like image, word file etc.


<form>..</form>

The form element creates a form spelling out how theform will operate based on its attributes.

<action>... </action>

The form action URL specifics where data is to be sent when a site visitor submits the form.

method=" "

The method attributes refers to the HTTP method(get post)" which dictates how to send the form data.

enctype=" "

This attributes dictates how the form data is to be enconded when submitting information back to the web server (for method="post" only).

autocomplete

Dictates wheather a form should have autocomplete on or off.

novalidate

Dictates wheather the form should not be validated when submitted.

accept-charsets

Identifies the character encording upon the form submission.

target

Tells where to display the form response after veing submitted generally one of the following:_blank,_self,_parent,_top.

<fieldset> ... </fieldset>

Identifies the group of all fields on the form.

<label>  ... </label>

A simple field label telling the user what to enter in each field.

<legend> ... </legend>

The form legend acts as a caption for the fieldset element.

<input />

 The form input attributes defines the type of field information to receive from a user.

No comments:

Post a Comment

Post Top Ad