validatesConfirmationOf()
Description
Validates that the value of the specified property also has an identical confirmation value (common when having a user type in their email address, choosing a password etc). The confirmation value only exists temporarily and never gets saved to the database. By convention the confirmation property has to be named the same as the property with "Confirmation" appended at the end. Using the password example, to confirm our password property we would create a property called passwordConfirmation.
Function Syntax
validatesConfirmationOf([ properties, message, when, if, unless ])
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
properties |
string |
No | |
Name of property or list of property names to validate against (can also be called with the property argument). |
message |
string |
No | [property] should match confirmation |
Supply a custom error message here to override the built-in one. |
when |
string |
No | onSave |
Pass in onCreate or onUpdate to limit when this validation occurs (by default validation will occur on both create and update, i.e. onSave). |
if |
string |
No | |
String expression to be evaluated that decides if validation will be run (if the expression returns true validation will run). |
unless |
string |
No | |
String expression to be evaluated that decides if validation will be run (if the expression returns false validation will run). |
Examples
<!--- Make sure that the user has to confirm their password correctly the first time they register (usually done by typing it again in a second form field) --->
<cfset validatesConfirmationOf(property="password", when="onCreate", message="Please confirm your chosen password properly!")>
