A practice project from The Odin Project - Full Stack JavaScript Path. This project demonstrates client-side form validation using the Constraint Validation API and custom JavaScript validation logic.
This browser form implements live inline validation to provide real-time feedback as users fill out registration fields. The form validates input as you type and when you leave each field, highlighting errors in red with helpful guidance messages.
- Email Address: Validates proper email format
- Country: Required dropdown selection
- Postal Code: Country-specific format validation
- Password: Minimum 8 characters with uppercase, lowercase, and number requirements
- Password Confirmation: Must match the password field
- π΄ Live validation - Validates as you type and on field blur
- π¨ Visual feedback - Invalid fields highlighted in red, valid in green
- π¬ Custom error messages - Clear guidance for fixing validation errors
- π Country-specific postal codes - Different patterns for US, UK, CA, AU, JP, PH, and more
- π Password strength validation - Enforces strong password requirements
- β Form submission handling - Prevents submission with errors, shows success message
- π± Responsive design - Works on all device sizes
- βΏ Accessible - ARIA attributes for screen readers
- HTML5 (with
novalidateattribute) - CSS3 (with
:validand:invalidpseudo-classes) - JavaScript (Constraint Validation API concepts)
- Webpack 5
- ESLint & Prettier
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- A modern web browser
- Clone the repository
git clone https://github.com/top-submissions/fullstackjs-validation-practice-form.git
cd fullstackjs-validation-practice-form- Install dependencies
npm install- Start development server
npm run devThe application will open automatically at http://localhost:8080
- Build for production
npm run buildProduction-optimized files will be generated in the dist/ directory.
This project demonstrates:
- Using JavaScript's Constraint Validation API
- Implementing custom validation logic
- Real-time form validation (blur and input events)
- Managing form state and error messages
- Styling validation states with CSS pseudo-classes
- Creating accessible forms with ARIA attributes
- Preventing form submission with active errors
- Required field
- Must match email pattern:
user@example.com
- Required selection from dropdown
- Required field
- Format varies by country:
- US: 12345 or 12345-6789
- Philippines: 4 digits
- UK: SW1A 1AA format
- Canada: K1A 0B1 format
- Australia: 4 digits
- Japan: 123-4567 format
- Required field
- Minimum 8 characters
- Must contain at least one uppercase letter
- Must contain at least one lowercase letter
- Must contain at least one number
- Required field
- Must exactly match the password field
- Chrome (latest 2 versions)
- Firefox (latest 2 versions)
- Safari (latest 2 versions)
- Edge (latest 2 versions)
Use the built-in deployment script:
npm run deployThis will build the project and deploy to GitHub Pages automatically.
The dist/ folder contains all files needed for deployment:
- Netlify: Drag and drop
dist/folder or connect repository - Vercel: Import repository or deploy
dist/ - Custom Server: Upload contents of
dist/
npm run dev- Start development server with hot reloadnpm run build- Build for productionnpm run build:dev- Build for developmentnpm run watch- Watch files and rebuild on changesnpm run deploy- Build and deploy to GitHub Pagesnpm run lint- Run ESLintnpm run lint:fix- Fix ESLint errors automaticallynpm run format- Format code with Prettiernpm run format:check- Check code formatting
This is a learning project, but feedback and suggestions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add some improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- The Odin Project - For the excellent curriculum and project guidelines
- MDN Web Docs - For comprehensive documentation on form validation
- The open-source community for inspiration and learning resources
Project Link: https://github.com/top-submissions/fullstackjs-validation-practice-form
Note: This project uses novalidate on the form element to handle all validation through JavaScript, as required by The Odin Project curriculum.