Articles in this section
Category / Section

How form data are validated and what are the default rules

Published:
Updated:

Introduction

Ensuring accurate and complete data collection is critical to maintaining a high-quality database and improving user experience. In Neostore, the registration form supports a powerful field-level validation system to help administrators enforce data standards. This article outlines how form data is validated and the default rules available.

Understanding these rules will help both technical and business users configure forms that capture the right information in the right format, minimizing errors and improving data usability across the platform.

Core Explanation

Field validation in Neostore occurs at the individual field level. Each field can be configured with specific rules to ensure the data entered is accurate and meets business requirements.

Here are the available validation rules:

Required

  • Indicates whether the field must be filled out.
  • For checkboxes and switchboxes, this means the box must be checked.

minLength

  • Defines the minimum number of characters required for a field’s value.
  • Useful for fields like names or identification numbers.

maxLength

  • Sets the maximum number of characters allowed in the field.
  • Helps prevent excessively long inputs that could disrupt layout or storage.

email

  • Combines two layers of validation:
    1. Regular Expression Check:
      Uses the following default regex to validate format:
      /^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/
      
      This regex can be overridden with a custom one if needed.
    2. Domain Check via DNS:
      Neostore verifies that the email domain accepts mail by checking for MX records.

phone

  • Validates phone numbers using the react-phone-number-input component.
  • This is based on Google’s international phone number validation library.
  • Ensures numbers are correctly formatted and country codes are recognized.

expression

  • Allows administrators to define a custom regular expression to validate the field.
  • Flexible option for enforcing format-specific data (e.g., postal codes, IDs).

equality

  • Compares the field’s value to:
    • Another field’s value (e.g., “Confirm Password”)
    • A static constant value
  • Ensures consistency and matching where required.

Tips & Best Practices

  • Use required sparingly: Making too many fields mandatory can negatively impact user experience.
  • Validate early: Implement client-side validation for faster feedback, and always reinforce with server-side checks.
  • Customize regex cautiously: Only override the default email regex if you fully understand the implications.
  • Use equality for sensitive fields: Perfect for validating repeated entries like passwords or emails.

Conclusion

Neostore’s form validation system offers a flexible and powerful way to ensure data quality. By leveraging default validation rules, administrators can create robust forms that help maintain clean, reliable datasets while enhancing user experience. For advanced needs, custom expressions and rule overrides provide even more control.

Need help applying a specific rule or debugging validation errors? Contact Neostore support or consult the developer documentation.

Access denied
Access denied