Framework  3.9
TimeValidator Class Reference

TimeValidator. More...

+ Inheritance diagram for TimeValidator:
+ Collaboration diagram for TimeValidator:

Public Member Functions

 TimeValidator ($field, $title)
 
 writeClient ()
 
- Public Member Functions inherited from AbstractValidator
 AbstractValidator ($field, $title)
 
 validate ()
 

Public Attributes

 $message
 
- Public Attributes inherited from AbstractValidator
 $field
 
 $title
 

Detailed Description

TimeValidator.

If the user enters a value in a time field, check if it is valid.

The hour html tag field name is the field name with "_hh" after it. The minute html tag field name is the field name with "_mm" after it.

Definition at line 657 of file validation.inc.

Member Function Documentation

◆ TimeValidator()

TimeValidator::TimeValidator (   $field,
  $title 
)

Definition at line 661 of file validation.inc.

662  {
663  $this->AbstractValidator($field, $title);
664  }
AbstractValidator($field, $title)
Definition: validation.inc:53

◆ writeClient()

TimeValidator::writeClient ( )

Reimplemented from AbstractValidator.

Definition at line 666 of file validation.inc.

667  {
668  if ($this->readOnly) return "";
669 
670 $script = <<<ENDSCRIPT
671  var hourObj = form["{$this->field}_hh"];
672  var minObj = form["{$this->field}_mm"];
673 
674  if (hourObj.value != "" && (hourObj.value < 1 || hourObj.value > 12))
675  {
676  alert("{$this->title} Hours must be in the range 1 to 12");
677  return false;
678  }
679 
680  if (minObj.value != "" && (minObj.value < 0 || minObj.value > 59))
681  {
682  alert("{$this->title} Minutes must be in the range 0 to 59");
683  return false;
684  }
685 
686 
687 ENDSCRIPT;
688 
689  return $script;
690  }

Member Data Documentation

◆ $message

TimeValidator::$message

Definition at line 659 of file validation.inc.


The documentation for this class was generated from the following file: