For this discussion, you are given a list of questions related to form validation. Simply answer the questions in your own words, using complete sentences.
1) Why would you want to disable browser-based validation?
2) Which element event would you use if you wanted to test an
element's value, but only after the element loses focus?
3) Assume a variable named "checkList" contains references to a
collection of checkboxes. How would you determine if the third
checkbox is checked? Write a statement that could be placed in an
"if" statement's expression.
4) What event usually causes a form's contents to be
validated?
5) What function would you use to check if a variable contains
numeric data?
Answer 1 .
By default browser provides validation for the fields of the form so now suppose the entered value fails those validation and if you are using any custom validation of your own then input received by your custom validation will be empty strings, also there are no alert or any other indication that validation of browser has failed other than field getting focused
So it is preferable to use novalidate in the form tag to bypass the browser based validation
Answer 2 .
onblur event is the event that is triggered only after the element loses focus so then you can test the value of the element.
Answer 3.
if(checklist[2].checked) // will check the checked property of Third checkbox element as array will begin from index 0
Answer 4 .
onSubmit event causes the triggering form validation on form submit.
Answer 5 .
isNaN built-in function is used to check if a value is not a number
For this discussion, you are given a list of questions related to form validation. Simply answer...
New Perspectives on HTML5 and CSS3. Solve Chapter 13 Case
Problem 3.
mas_register.js
"use strict";
/*
New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
Tutorial 13
Case Problem 3
Filename: mas_register.js
Author:
Date:
Function List
=============
formTest()
Performs a validation test on the selection of the conference
session package and the conference discount number
calcCart()
Calculates the cost of the registration and saves data
in session storage
writeSessionValues()
Writes data values from session storage in to the
registration...