check duration is under 24 hours, colorpicker updates on drag, picker for duration without am/pm.
This commit is contained in:
naomiaro 2011-01-30 21:42:53 -05:00
parent 092b36c346
commit 48c1ce77b9
6 changed files with 55 additions and 7 deletions

View file

@ -37,7 +37,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('HH:mm'))
array('regex', false, array('([0-2][0-3]:[0-5][0-5])', 'messages' => 'Show must be under 24 hours'))
)
));
@ -51,6 +51,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
public function checkReliantFields($formData) {
$valid = true;
$now_timestamp = date("Y-m-d H:i:s");
$start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time'];
@ -59,10 +61,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
if($start_epoch < $now_epoch) {
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
return false;
$valid = false;
}
if(strtotime("23:59") < strtotime($formData["add_show_duration"])) {
$this->getElement('add_show_duration')->setErrors(array('Max show size: 23:59'));
$valid = false;
}
return true;
return $valid;
}
}