Stadium
  • Home
  • Academy
  • How it works
    • Designer
    • Application Manager
    • Application users and roles
    • Designing applications
    • User API
  • Features
    • Application
    • Create a Form
    • Embedded Files
    • Events
    • Expression Editor
    • Pages
    • Preview
    • Publish
    • Scripts and Event Handlers
    • Session Variables
    • Settings
    • Styles
    • StyleSheet
    • Templates
    • Types
    • Validations Cheat Sheet
  • Connectors
    • Database Connector
    • File System Connector
    • Web Service Connector
  • Controls
    • Button
    • Chart
    • Checkbox
    • Checkbox List
    • Container
    • Data Grid
    • Date Picker
    • Drop Down
    • Flexbox
    • Grid
    • Image
    • Label
    • Link
    • Menu
    • Panel
    • Radio Button List
    • Repeater
    • Table
    • Text Box
    • Upload File
  • Actions
    • Async
    • Call Web Service
    • Decision (If/Else)
    • Display Message Box
    • Download File
    • For Each
    • Java Script
    • Navigate To Page
    • Notification
    • Set Value
    • Variable
    • While
  • Release Notes
    • 6.12.3272
    • 6.12.3270
    • 6.12.3268
    • 6.12.3264
    • 6.11.3223
    • 6.11.3221
    • 6.11.3220
    • 6.11.3218
    • 6.11.3210
    • 6.10.3155
    • 6.10.3151
    • 6.9.3102
    • 6.8.3100
    • 6.7.3096
    • 6.6.3082
    • 6.6.3081
    • 6.6.3080
    • 6.6.3075
    • 6.5.3055
    • 6.4.3036
    • 6.4.3034
    • 6.4.3033
    • 6.3.3019
    • 6.2.2999
    • 6.2.3001
    • 6.1.2990
    • 6.0.2972
    • 6.0.2970
    • 6.0.2969
Powered by GitBook
On this page
  • Validation Expressions Cheat Sheet
  • Overview
  • Stadium Version
  • Required / Not Required
  • IsValid
  • IsValid Rule
  • Copy-and-Paste Expressions
  • Use AI to generate a RegEx
  • Date Range (DatePicker)
  • Number Range
  • Combining criteria
  • Script-Based Validations

Was this helpful?

  1. Features

Validations Cheat Sheet

Validation Expressions Cheat Sheet

This readme describes how to create validations in Stadium 6.12 and upwards.

Overview

The release of Stadium 6.12 brings some changes to how Control validations work in Stadium. Instead of a simple selection from a limited set of predefined options, we can now use expressions to flexibly validate control values and properties as well as the values and properties of related controls.

Full feature set:

  1. Custom validation definition using Javascript expressions

  2. Custom error message definition

  3. Programmatic error state setting

  4. Programmatic error message definition

When upgrading a pre-6.12 application in the 6.12 Stadium Designer, older validations will automatically be upgraded.

Stadium Version

6.12 and upwards

Required / Not Required

To mark a Control as required, check the "Required" checkbox and enter a validation message

IsValid

IsValid Rule

The "IsValid Rule" property accepts a Javascript expression. If the Control value passes the expression the IsValid property is true and the Control has passed the validation. If the Control value does not pass the expression the IsValid property is false, the Control is placed in an error state and the error message is displayed under the Control.

Copy-and-Paste Expressions

A wide range of validations can be performed with the help of regular expressions. However, regular expressions are not always easy to write. Below are regular expressions for all current Stadium validations.

To use these examples, adjust the Control name ("TextBox" in this example) and copy & paste any of these expressions into the "IsValid" rule in the properties panel

IsEmail

/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(TextBox.Text)

IsAmount

/^\d+(\.\d{1,2})?$/.test(TextBox.Text)

IsNumber

/^\d+$/.test(TextBox.Text)
Number.isInteger(TextBox.Text)

IsURL

With http / https

/https?:\/\/[-a-z0-9@:%._\+~#=]{1,256}\.[a-z0-9()]{1,6}\b([-a-z0-9()@:%_\+.~#?&//=]*)/i.test(TextBox.Text)

Text length is 8 or more

TextBox.Text.length > 7

Password validation

Rules: 8 – 16 characters, at least one number, at least one special character

/^(?=.*[\d])(?=.*[!@#$%^&*])[\w!@#$%^&*]{8,16}$/.test(TextBox.Text)

Characters only

/^[a-zA-Z]*$/.test(TextBox.Text)

Use AI to generate a RegEx

If you need a specific RegEx, but are not sure how to write it, I came across a function in the Google Gemini AI tool that will generate a RegEx from a text prompt.

Here is an example prompt for a complex RegEx:

Give me a JavaScript regex that checks a string for the following:
The string must have 8-24 characters.
The string must contain upper and lowercase characters.
The string must contain at least one number.
The string must have at least one of the following special characters: ~!@#$%^&*()_+=-:;<,>.?

The result:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+=-:;<,>.?]).{8,24}$/

Implementing this as a Stadium Validation:

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+=-:;<,>.?]).{8,24}$/.test(TextBox.Text)

Date Range (DatePicker)

Date between Jan 1, 2023 & today

DatePicker.Date >= new Date('01/01/2023') && DatePicker.Date <= new Date()

Number Range

Number between 1 and 12

TextBox.Text > 0 && TextBox.Text < 13

Combining criteria

When values from one or from more Controls are required to adhere to multiple criteria (x AND y), the criteria can be combined by adding a double ampersand (&&)

CheckBox.Checked && DatePicker.Date >= new Date('01/01/2023')

When values from one or from more Controls are required to adhere to any listed criteria (x OR y), the criteria can be combined by adding a double pipe (||)

new Date(DatePicker.Date).getFullYear() == 2024 || new Date(DatePicker.Date).getFullYear() == 2025

Script-Based Validations

Validation errors can be triggered in scripts by setting "IsValid" flags and "Error Text" properties using SetValue actions.

If an "IsValid" flag is set to "false", the text provided in the "Error Text" property is shown under the field. The "IsValid" flag will remain "false" until it is set to "true" using another SetValue action.

Scripts execute once all controls pass the "IsValid Rules". Script executions do NOT stop when an "IsValid" flag is set to "false". Data processing may need to be done conditionally as shown.

PreviousTypesNextConnectors

Last updated 2 months ago

Was this helpful?

The "IsValid" property is a boolean flag that defines when Controls are in an error state. This property is "true" by default and is set to "false" when it fails an "IsValid Rule". It can also be set .

Google AI Studio RegEx Text Prompt
programmatically in scripts