Use the isNaN() function in validateForm() to verify the user id is a number. Display "Invalid user id" in the console log if the user id is not a number. Use the event method preventDefault() to avoid submitting the form when the input is invalid.
Added by Travis G.
Step 1
```javascript function validateForm(event) { // Code to validate the user id } ``` Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 61 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
My Form First Name Street Address State Zip Code Submit City
Akash M.
Supreeta N.
Create the page as shown in below picture. The page uses validation control both server and client side. The respective message for each validation is shown in second picture.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD