Difference between revisions of "How to add special validation for some fields on signup form"

From aMember Pro Documentation
Jump to: navigation, search
Line 1: Line 1:
Create /amember/application/configs/site.php with this code:  
+
Add this code to [[site.php file]]:
 
+
 
<source>
 
<source>
 
<?php
 
<?php

Revision as of 03:39, 9 August 2013

Add this code to site.php file:

<?php
Am_Di::getInstance()->hook->add(Am_Event::VALIDATE_SAVED_FORM, 'siteValidateForm');
 
function siteValidateForm(Am_Event_ValidateSavedForm $event)
{
    $form = $event->getForm();
    $vars = $form->getValue();
    if (isset($vars['email']) && ($vars['email'] != 'test')) { // perform some validation
        $event->addError('Some Error Accured!');
    }
}