This project is a simple HTML form that includes client-side data validation using JavaScript. Upon successful form submission, the form data is saved as a JSON file on the user's local machine.
- HTML form with fields for first name, last name, other names, email address, phone number, and gender
- Client-side data validation using JavaScript
- First name and last name are required and cannot be less than 1 character or contain numbers
- Other names are optional but cannot contain numbers
- Email address must be in a valid format
- Phone number must be exactly 10 digits
- Gender is required
- Form data is saved as a JSON file named
database.jsonon the user's local machine upon successful submission
- Clone or download the project files.
- Open the
index.htmlfile in a web browser. - Fill out the form fields with the required information.
- Click the "Submit" button.
- If any validation errors occur, they will be displayed next to the respective form fields.
- If the form is valid, your browser will prompt you to download a file named
database.json. - Navigate to your browser's default download location and open the
database.jsonfile to view the saved form data.
- Create a simple HTML Form containing the following fields:
a. First nameb. Last namec. Other namesd. Email addresse. Phone numberf. Gender (Dropdown)g. Submit button
- Make sure to do proper validation that meets the following criteria:
-
The name cannot be less than 1 characterfirst name and last name are requiredother names is optionalThe name cannot contain numbersThe email has to be a valid email with @ and .Phone number must be a specific number of charactersGender is required
- When the form is submitted, display specific validation errors if any, if no errors, submit the content of the form to a file called 'database.json'
- Use Codepen for your code.
- Submit the public URL for the Codepen
- Add instructions on how to test your code (if any)