Skip to content

Miscellaneous

validatesExclusionOf()

validatesExclusionOf() — returns any

Validates that the value of the specified property does not exist in the supplied list.

NameTypeRequiredDefaultDescription
propertiesstringyesSee documentation for validatesConfirmationOf.
liststringyesSingle value or list of values that should not be allowed.
messagestringyes[property] is reservedSee documentation for validatesConfirmationOf.
whenstringyesonSaveSee documentation for validatesConfirmationOf.
allowBlankbooleanyesfalseIf set to true, validation will be skipped if the property value is an empty string or doesn’t exist at all. This is useful if you only want to run this validation after it passes the validatesPresenceOf test, thus avoiding duplicate error messages if it doesn’t.
conditionstringyesSee documentation for validatesConfirmationOf.
unlessstringyesSee documentation for validatesConfirmationOf.
// Do not allow "PHP" or "Fortran" to be saved to the database as a cool language
validatesExclusionOf(property="coolLanguage", list="php,fortran", message="Haha, you can not be serious. Try again, please.");