How to add special validation for some fields on signup form

From aMember Pro Documentation
Revision as of 02:38, 10 January 2013 by Caesar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Create /amember/application/configs/site.php with this code:

<?php
Am_Di::getInstance()->hook->add(Am_Event::VALIDATE_SAVED_FORM, 'siteValidateForm');
 
function siteValidateForm(Am_Event_ValidateSavedForm $event)
{
    $form = $event->getForm();
    /* @var $email HTML_QuickForm2_Element */
    list($email, ) = $form->getElementsByName('email');
    if ($email != 'test')
        $email->setError('Some Error Occured!');
}