Integer validator
miValidatorInt class performs sanity check over unsigned integers. 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' => 'UserCreditCard',
'validator' => 'miValidatorInt'
)
);
}
?>
* Created runtime
<?php
class miUserDataManager extends miDataManager {
protected $_dataFields = array(
array(
'field' => 'miWebFormWidgetText',
'data' => 'UserCreditCard'
)
);
public function initWebForm(miWebForm $form)
{
parent::initWebForm($form);
$validator = new miValidatorInt($form, 'UserCreditCard');
$form->addValidator('UserCreditCard', $validator);
}
}
?>