Validation Rules Reference
The following table below all of Trongate's inbuilt form validation rules.
| Rule | Parameter | Description | Example |
|---|---|---|---|
| required | No | Returns FALSE if posted value is empty. | required |
| min_length | Yes | Returns FALSE if posted value has a string length less than specified value. | min_length[3] |
| max_length | Yes | Returns FALSE if posted value has a string length greater than specified value. | max_length[75] |
| exact_length | Yes | Returns FALSE unless posted value has a string length equal to specified value. | exact_length[12] |
| greater_than | Yes | Returns FALSE unless posted value is greater than specified value. | greater_than[17] |
| less_than | Yes | Returns FALSE unless posted value is less than specified value. | less_than[31] |
| numeric | No | Returns FALSE is posted value is not numeric. | numeric |
| integer | No | Returns FALSE is posted value is not an integer (i.e., not a whole number). | integer |
| decimal | No | Returns FALSE posted value is not numeric with at least one decimal place. | decimal |
| matches | Yes | Returns FALSE if posted value does not match another specified form element. | matches[password] |
| differs | Yes | Returns false if form element matches another specified form element. | differs[name] |
| valid_email | No | Returns FALSE if posted value is not formatted like an email address. | valid_email |
| valid_datepicker_us | No | Returns FALSE unless posted value is a valid datepicker value of the United States of America format mm-dd-yyyy. | valid_datepicker_us |
| valid_datepicker_eu | No | Returns FALSE if posted value is not a valid datepicker value of the European format dd-mm-yyyy. | valid_datepicker_eu |
| valid_datetimepicker_us | No | Returns FALSE if posted value is not a valid datetime picker value. | valid_datetimepicker_us |
| valid_datetimepicker_eu | No | Returns FALSE if posted value is not a valid datetime picker value. | valid_datetimepicker_eu |
| valid_time | No | Returns FALSE if posted value is not a valid time. | valid_time |