Mashup Builder > Functions > Validator
Validator
Validator functions are non-visual widgets that you can use to evaluate JavaScript expressions. You can use the function to create expressions that validate user input and return a true or false boolean value. For example, a user can enter a number pattern that does not match a specific format in a text field. You can create a Validator function to validate the number format before saving it to a data table.
Creating a Validator Function
1. On the Functions panel, click . The New Function dialog opens.
2. Select Validator from the drop-down list.
3. Enter a name for the function, and then click Next.
4. Add parameters, and then enter the JavaScript expression to evaluate.
5. Click Done.
The function is added to the Functions panel under Validators.
Function Options
You can set the following configuration options for the function:
Description—Sets a description for the function.
Expression—The JavaScript expression to evaluate.
Output—Returns output from the evaluated expression.
Auto Evaluate—Evaluates the expression automatically when the input data is changed.
Adding Parameters
You must add input parameters to bind data from other services and properties. To add a parameter, do the following:
1. Click Edit to open the function configuration dialog.
2. Click the Add Parameter button to add additional parameters to the function.
Enter a parameter name to use in your expression.
Select a parameter Base Type to specify the type of data that you can bind to the parameter.
3. Click Done.
The parameters are listed as bindable properties under the Parameters list for the function.
Using JavaScript Expressions
Define the expression:
You can use all of the JavaScript comparison operators. For simple comparison expressions, the if() and else() statements are not required.
If the input is a boolean type, you can enter "input" directly in the expression field.
If the input is a numeric type, you can enter "input==1" directly in the expression field.
Evaluate the expression:
The Validator function is triggered by the Evaluate property. You can bind this property to events, such as the Clicked property of a Button widget.
* 
Enable the Auto Evaluate option to evaluate the expression automatically when an input parameter is changed.
The expression returns a Boolean result. You can bind the True and False event properties to trigger other services or events within the mashup, such as Navigate, Execute, or Refresh.
Function Properties
The Validator function contains the following properties.
Property
Description
Base Type
Default Value
Bindable? (Y/N)
Localizable? (Y/N)
Evaluate
A service that evaluates the expression.
n/a
n/a
Y
N
Output
The output of the Validator expression.
n/a
n/a
Y
N
True
An event that triggers when the evaluated expression is True.
n/a
n/a
Y
N
False
An event that triggers when the evaluated expression is False.
n/a
n/a
Y
N
Was this helpful?