Current Record: validateRegistrationForm #15

validateRegistrationForm() hook A hook that validates the input into the user registration form to make sure that the input is valid. Sig...

Current Record: validateRegistrationForm #15

validateRegistrationForm() hook A hook that validates the input into the user registration form to make sure that the input is valid. Sig...

validateRegistrationForm

[Permalink]

validateRegistrationForm() hook

A hook that validates the input into the user registration form to make sure that the input is valid.

Signature

function validateRegistrationForm( array $values ) : mixed

Parameters

Name Description
$values An associative array of the input values of the registration form.
returns Mixed. If this method returns a PEAR_Error object then the validation will fail - and the user will be asked to correct his input.

Example

<?php
class conf_ApplicationDelegate {
    function validateRegistrationForm($values){
        if ( $values['age'] < 18 ){
            return PEAR::raiseError("Sorry you must be at least 18 years old to join this site.");
        }
        return true;
    }
}

Validation via the Users table Delegate class

Note that since the registration form is just a "new record form" for the users table, it is also possible (and preferred) to do validation through the users table delegate class?.

See Also

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved