I believe this is what you were wanting. You're welcome.
This will add Color Hex Validation in Nickman's Form Manager 2.0 Plugin.
In the plugin files, open:
admin/modules/config/forms.php
and find all instances of (there are four):
Change them to:
Code:
"5"=>"All letters","6"=>"A Color Hex"
Save the file and close. Now open:
forms.php (included to be uploaded in the site root).
and find this at near-about line no. 602:
Code:
if ($items[$name]['type'] == 5)
{
validate_letters($name,$value);
}
Add just after that (before final closing curly brace '}' of 'validate' function:
Code:
if ($items[$name]['type'] == 6)
{
validate_colorhex($name,$value);
}
Now find this function near about line no. 645:
Code:
function validate_numeric($name,$value)
{
if (!is_numeric($value))
{
form_error("The field $name was not a number");
}
}
Add just after that:
Code:
function validate_colorhex($name,$colhex)
{
if (!preg_match("/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/",$colhex))
{
form_error("The field $name was not a valid color hex code");
}
}
Save the file and close. Re-upload two modified files, activate the plugin.
Now you have additional option for the fields with Color Hex Validation.