Back
validatesConfirmationOf()
Validates that the value of the specified property also has an identical confirmation value.
This is common when having a user type in their email address a second time to confirm, confirming a password by typing it a second time, 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
.
// 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)
validatesConfirmationOf(property="password", when="onCreate", message="Your password and its confirmation do not match. Please try again.");
Copied!