HTML and CSS Reference
In-Depth Information
h e novalidate attribute is a Boolean used in form submission; it blocks validation of the
user-inputted data during submission. h is can save time, but it can also lead to foul-ups.
Sometimes a simple form or a wide-open (unknown submission data) form does not validate
because setting up traps for validation is unknown as well. If present in the form tag, the
submitted elements will not be validated:
< form nonvalidate>
h at ef ectively blocks submission validation.
A better solution lies in the Boolean formnovalidate and required attributes that can
be placed in individual input elements. For example, the following form has no validation for
a cancel button and the middle name is not required, although the i rst and last names are.
< form name =motherShip accept-charset =utf- 8 >
First name:
< input type = text name =fn required>
< br >
Middle name:
< input type = text name =mn >
< br >
Last name:
< input type = text name =ln required>
< br >
< input type =submit name =submit value = ”Send the info!” >
< input type =submit formnovalidate name =cancel value = ”Cancel” >
</ form >
h e accept-charset , enctype , and novalidate attributes aren't ones you're likely to
use too much. However, the input element attributes for requiring data entry and nonvalida-
tion can be quite handy.
Action and method
You're not going to need these two important attributes until Chapter 16, so this section is
going to be brief and to the point. h e action attribute is assigned a URL that's launched as
soon as the Submit button is clicked. It sends the form data to the URL (a server-side program
like Perl, PHP, or ASP). h e method attribute is either POST or GET . When you send data
from your Web page or send and retrieve data, use POST . If all you want to do is retrieve data,
use GET . h e following shows typical values assigned to the two attributes:
< form action = ”” method = ”post” >
In Chapter 16, you'll i nd that both of these attributes are always used when dealing with PHP.
Search WWH ::

Custom Search