Powered by SmartDoc

Format for rules

Examples of format are the following.

name == eMyNamef
(title =~ /R/) and (title.size > 10)
not (count < 20)

Format for rules is gattribute operator valueh (Attribute is accessor method or instance variable defined in component class). You can join rules with and/or, use notto deny rules. If you use the operators, enclose rules with parenthesis.

Converting data types

Last rule In the above example, set value as number. Form data is setted as string for the valule, but the data is converted temporarily when validating. For example, the following validates input as number whether greater than or equal to 100 and less than equal to 500.

Number : CKTextField {
  value    = number
  validate = g(number >= 100) and (number <= 500)g
  pass     = pass_number
}

Operators

Operators can be included in rules are the following.

Operators in rules
Operator Description
== Both sides are equal.
!= Both sides are not equal.
> Left is greater than right.
< Left is less then right.
>= Left is greater than or equal to right.
<= Left is less than or equal to right.
=~ Pattern matching.