Gsm validator
miValidatorGsm class performs sanity check over ten digit GSM numbers. It can be mapped in the data manager, or created runtime.
* Mapped in the data manager class
<?php
class miUserDataManager extends miDataManager {
protected $_dataFields = array(
array(
'field' => 'miWebFormWidgetText',
'data' => 'UserMobilePhone',
'validator' => 'miValidatorGsm'
)
);
}
?>
* Created runtime
<?php
class miUserDataManager extends miDataManager {
protected $_dataFields = array(
array(
'field' => 'miWebFormWidgetText',
'data' => 'UserMobilePhone'
)
);
public function initWebForm(miWebForm $form)
{
parent::initWebForm($form);
$validator = new miValidatorGsm($form, 'UserMobilePhone');
$form->addValidator('UserMobilePhone', $validator);
}
}
?>