Skip to content

Model Configuration

validatesPresenceOf()

validatesPresenceOf() — returns void

Available in: model Category: Validation Functions

Validates that the specified property exists and that its value is not blank.

NameTypeRequiredDefaultDescription
propertiesstringno—Name of property or list of property names to validate against (can also be called with the property argument).
messagestringno[property] can't be emptySupply a custom error message here to override the built-in one.
whenstringnoonSavePass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave).
conditionstringno—String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run).
unlessstringno—String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run).