For the complete documentation index, see llms.txt. This page is also available as Markdown.

Validation

Validating fields (text or other) is crucial for ensuring that data entered by users meets specific criteria or formats and for maintaining data integrity and security.

In Jigx Builder you can use regular expressions (regex) for text validation. They allow for pattern matching and can enforce complex rules for text fields such as email addresses, phone numbers, usernames, passwords, and more. When applied to text validation, regex can be used to check if the input text matches the desired format. If it is not valid, an invalid message is displayed.

In Jigx you combine a JSONata expression with a Regex expressions to create a validation pattern and provide a message if the pattern does not match.

Creating the validation expression:

  1. JSONata expression - =@ctx.components.email.state.value

  2. Regex expression - /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/

  3. Validation message - not an email

Combine the three above to validate an email address in the text-field component.

Regex and JSONata Expression examples

Here are some common validation expressions to create and use for text field validation.

Validation
Expected result

Phone number

+271234556789

Email

name@example.com

Credit Card

Typically 13-16 digits, with spaces or dashes optional, and includes checks for Visa, MasterCard, American Express, and Discover. 1111-1111-1111-1111 or 1111 1111 1111 1111

ZIP/Postal code (US)

5-digit codes, e.g. 10036

XXX-XX-XXXX

National Insurance (UK)

AA123456C

US Date (DD/MM/YYYY)

23/07/2024

Date (MM/DD/YYYY)

03/28/2023

Date (DD Month YYYY)

25 July 2024

Date (yyyy/mm/dd)

2024/08/30

Decimal

111,25

Time (H:MM AM/PM)

12:15 AM or 08:45 PM

Date (MM:SS or HH:MM)

08:10

Time in 24-hour format

01:00

URL

example.com or https://example.com

ISBN

978-1-4302-1998-9

Strict alpha numeric

JohnSmith

Alpha numeric with spaces

John Smith

Numbers and spaces only

56575 76 6

See Also

Last updated

Was this helpful?