Thanks ga.n,
I was trying to add the class to tl_member.php before, not tl_module.php
I'm sure I'm closer.... but....same error...
Fatal error: Could not load class tl_school_schools in /hsphere/local/home/xxxxx/xxxxxxxx.com/system/functions.php on line 67
In my config I also have another custom rgxp, could the fact that there is 2 cause a conflict?
from config.php
Code:
//HOOK TO Validate urls ...fees, website, approved_video_link
$GLOBALS['TL_HOOKS']['addCustomRegexp'][] = array('tl_school_schools', 'addCustomRegexp');
//for the tl_member custom rgxp on Registration to check schoolnzqaid against tl_school_schools nzqaid
$GLOBALS['TL_HOOKS']['addCustomRegexp'][] = array('nzqaidRgxp', 'checkNzqaid');
and my rgxp added to tl_module.php
Code:
class nzqaidRgxp extends Backend
{
public function checkNzqaid($strRegexp, $varValue, Widget $objWidget)
{
if ($strRegexp == 'nzqaid')
{
//check $varValue against database
$objnzqaid = $this->Database->prepare("SELECT nzqaid"
. " FROM tl_school_schools"
. " WHERE nzqaid =? ")
->execute($varValue);
if ($objnzqaid->numRows() < 1)
{
$objWidget->addError($objWidget->label . ' ...crap... ');
}
return true;
}
return false;
}
}
and the new eval in tl_members.php
Code:
'eval' => array('mandatory'=>true, 'unique'=>true, 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'address', 'tl_class'=>'w50', 'rgxp'=>'nzqaid', 'maxlength'=>7)
Bookmarks