Date validator
miValidatorDate class performs sanity check over date in format YYYY-MM-DD. 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' => 'UserBirthDate',
'validator' => 'miValidatorDate'
)
);
}
?>
* Created runtime
<?php
class miUserDataManager extends miDataManager {
protected $_dataFields = array(
array(
'field' => 'miWebFormWidgetText',
'data' => 'UserBirthDate'
)
);
public function initWebForm(miWebForm $form)
{
parent::initWebForm($form);
$validator = new miValidatorDate($form, 'UserBirthDate');
$form->addValidator('UserBirthDate', $validator);
}
}
?>