Skip to content

πŸ’‘[Feature]: Feature Request: Implement Advanced Custom Form ValidationsΒ #513

@divysaxena24

Description

@divysaxena24

Is there an existing issue for this?

  • I have searched the existing issues

Feature Description

Currently, the contact form relies on default Bootstrap/browser validations (e.g., HTML5 required attribute showing "Please fill out this field").
This provides a poor user experience and inconsistent error handling across browsers.

We need to implement advanced custom validations with better control, customization, and user-friendly error messages.


Use Case

Proposed Improvements:

  1. Custom Validation Rules

    • First Name & Last Name: Minimum 2 characters, alphabets only.
    • Email: Valid email format check (regex-based).
    • Subject: Mandatory selection from the dropdown.
    • Message: Minimum 10 characters required.
  2. Inline Error Messages

    • Display error messages directly under the respective input fields.
    • Example:
      • ❌ "First name must be at least 2 characters long."
      • ❌ "Please enter a valid email address."
  3. Real-time Validation

    • Validate fields on blur and while typing instead of only on submit.
    • Highlight invalid fields with a red border and error message.
  4. Accessibility

    • Ensure ARIA roles and attributes for screen readers.
    • Clear error summaries for users relying on assistive technologies.
  5. Validation Library (Optional)

    • Consider using lightweight validation libraries like Yup, Validator.js, or implement a custom vanilla JS solution.

Benefits

  • Improved user experience with clear and contextual error messages.
  • Cross-browser consistency (no reliance on default browser popups).
  • Easier to extend validation rules in the future.

Add ScreenShots

Image

Priority

High

Record

  • I have read the Contributing Guidelines
  • Are you a GSSOC'25 contributor
  • I want to work on this issue

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions