Validator dialog box usage for fieldGroup

Is there any example regarding the use of built in Validator dialog boxes?
I cannot find examples or documentation regarding the use of “script reference” and “script text”.

Generic UI => fieldGroup => Properties => Fields => Validator =>
It has 3 fields: Class / Script reference / Script text.

Please see if there’s any example of the usage and syntax for these 3 fields.

Thank

Hi Jeremy,

We have one working example in Sampler, please take a look. If it remains unclear, let us know.

We did checked out the example on the sampler. However, it didn’t mention anything regarding the usage of “script reference” and “script text”. Wonder if there’s any example somewhere.
Thanks

1 Like

Hi, below are the simplest examples of using validators:

  1. Script text
<field property="year">
    <validator>
        value ==~ /\d+/
    </validator>
</field>
  1. Script reference
<field property="zipCode">
    <validator script="com.company.demo.web.address.ZipValidator"/>
</field>

ZipValidator.groovy

package com.company.demo.web.scripts

return (value ==~ /\d+/)

Thank you for the question, it’s worth including in the documentation. We will do this.

2 Likes