You can attach a script to the Submit button in a form to verify the entire contents of the form as it is submitted.
You may prefer to add event handlers to the individual form elements to check them whenever they change.
This is very like the traditional data entry approach to building database loading systems.
Historically, a data entry system would carry out checks at the end of entering each field of data. It would then carry out checks on the whole record before loading it into the database. At that point some integrity checks may also come into play.
In the context of form data verification, our field end checks correspond to the scripts that run when a Form element changes. They can only logically check the internal integrity of that individual form element. They should be concerned with correct formatting of the value and range checking it for validity and size.
Our record end checks in the context of Form verification are done when the Submit button is pressed. This can check the integrity of data from field to field. That is best done at this point because if it's done at the field editing level, it needs to take account of default values which need to be considered as valid entry data. That complicates the field integrity checks. Cross-checking fields with one another should logically be done at a higher administrative level.
If all the fields correlate, the form can be submitted. If one or more needs to be corrected, a message can be presented and the offending item marked, selected or focussed for correction.