'number',
'url',
'email',
+ 'color',
);
/**
$attributes = '', $required = FALSE, $extra = NULL
) {
// Fudge some extra types that quickform doesn't support
+ $inputType = $type;
if ($type == 'wysiwyg' || in_array($type, self::$html5Types)) {
$attributes = ($attributes ? $attributes : array()) + array('class' => '');
$attributes['class'] = ltrim($attributes['class'] . " crm-form-$type");
CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element));
}
+ if ($inputType == 'color') {
+ $this->addRule($name, ts('%1 must contain a color value e.g. #ffffff.', array(1 => $label)), 'regex', '/#[0-9a-fA-F]{6}/');
+ }
+
if ($required) {
if ($type == 'file') {
$error = $this->addRule($name, ts('%1 is a required field.', array(1 => $label)), 'uploadedfile');