Hi everyone, I'm very new to the world of programming under Silverstripe CMS and I love use it. I have installed this module
https://github.com/tractorcow/silverstripe-colorpicker/tree/master (ColorPicker). I have installed it into Page and Setting SiteConfig. When I using it with Page, there's no problem with the validation, but when I'm using it into Setting tab, the validation see to stall the CMS and I must reload my windows to silvertripeinstallation/admin because I cant click on other menu or retry submiting the form.
I maded a modification into the script to cancel bad color validation and return it blank and true. Is it a good idea?
I put a screenshot in attachment.
Thanks for your help!
------------
original code
------------
public function validate($validator) {
if(!empty ($this->value) && !preg_match('/^[A-f0-9]{6}$/', $this->value))
$validator->validationError($this->name, _t("ColourPicker.VALIDCOLOURFORMAT", "Please enter a valid color in hexadecimal format."), "validation", false);
return false;
}
return true;
}
-----------
code modified
-----------
public function validate($validator) {
if(!empty($this->value) && !preg_match("/^#?([a-f0-9]{3}$)|([a-f0-9]{6}$)/i", $this->value)) {
$this->value="";
return true;
}
return true;
}
-----------