live link :- https://server-side-validation.onrender.com
A simple web application demonstrating complex HTML forms with client-side and server-side validation, and temporary data storage using MERN stack (Node.js/Express).
- Complex HTML Form: Registration form with various input types (text, email, password, number, select, checkboxes).
- Client-side Validation: Inline JavaScript validates form fields before submission.
- Server-side Validation: Node.js/Express server validates data and checks for duplicates.
- Temporary Storage: Validated data is stored in server memory (resets on server restart).
- Node.js installed on your system
- npm (comes with Node.js)
-
Navigate to the project directory:
cd c:\Users\pc\Desktop\task2 -
Install dependencies:
npm install
-
Start the server:
npm start -
Open your web browser and go to
http://localhost:3000
- Fill out the registration form with valid data.
- Client-side validation will prevent submission if data is invalid.
- Server-side validation provides additional checks and stores data.
- View submitted data by visiting
http://localhost:3000/data(for demonstration).
- Full Name: At least 2 characters
- Email: Valid email format
- Password: At least 6 characters
- Confirm Password: Must match password
- Age: Between 18 and 120
- Gender: Select from options
- Interests: Select at least one checkbox
- Port 3000 already in use: Change the PORT variable in
server.jsto a different number. - Node.js not found: Install Node.js from https://nodejs.org/
- Dependencies not installing: Ensure you have internet connection and try
npm installagain. - Form not submitting: Check browser console for JavaScript errors.
- Server errors: Check terminal/console output for error messages.
Data is stored temporarily in server memory. It will be lost when the server restarts. For persistent storage, consider using a database like MongoDB or SQLite.