示例#1
0
 public function validateColor($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement)
 {
     if (!empty($sValue) && !preg_match("/^#[a-fA-F0-9]{6}([a-fA-F0-9]{2})?\$/", $sValue)) {
         return "<strong>" . $oElement->option("label") . "</strong> is not a valid color with format '#RRGGBB' or '#RRGGBBAA' in hexadecimal values.";
     }
     return TRUE;
 }
示例#2
0
 public function validateTokenid($sValue, \Formal\Form\Morphology $oMorpho, \Formal\Element $oElement)
 {
     if (!preg_match("/^[a-z0-9\\-]+\$/", $sValue)) {
         return "<strong>" . $oElement->option("label") . "</strong> is not valid. Allowed characters are digits, lowercase letters and the dash symbol '-'.";
     }
     return TRUE;
 }