Validation Trigger parses empty integer fields as having val

Posted by Rollbase User on 14-Jan-2010 15:24

Validation Trigger converts empty integer fields to "0" if field is left empty. I am trying to use a validation trigger to make sure a field has data in it, before the form can be submitted. Example: if ("{!number_units}" == "") return "The Number of Units was not entered. Please fill in the field 'No. of units' to continue." When I debug the trigger with a record that I know has left the field blank. I get: function wrapper() { if ("0" == "") return "The Number of Units was not entered. Please fill in the field 'No. of units' to continue." } wrapper(); RESULT: null

All Replies

Posted by Admin on 14-Jan-2010 17:16

It looks like your field number_unit is numeric. In this case empty (null) value for this field is 0, not "".
Anyway, use safer syntax:

if ("{!number_units}" == "" || "{!number_units}" == "0") ...

This thread is closed