HTML and CSS Reference
In-Depth Information
Listing 2.6. app.js—Changing the form action in older browsers
If you open the page in a browser that doesn't support the formaction attribute, such
as IE9, clicking the Submit Order button submits the form to the /submit URL. Under the
same initial conditions, clicking the Save Order button submits the form to the /save URL.
You'll also notice that the validation doesn't work; don't worry, you'll add a fallback for
that later in the chapter.
Progress check
To this point, you've created the major pieces of the form: the Contact Details, Login De-
tails, Order Details, and Payment Details sections. Using new HTML5 input types, such
as email or tel , the new input attributes such as required , and the general data-*
attribute and <output> element, can simplify coding for some browsers. Another tedious
task, the implementation of bypassing data validation when saving an incomplete form, can
be simplified for browsers that support the new input attributes formnovalidate and
formaction .
In the next section, you'll implement the computational logic behind the Order Details sec-
tion, taking the quantity values entered by the user, then calculating and displaying the total
values for each item and the entire order.
Search WWH ::




Custom Search