Options
Option | HTML attribute | Type | Description |
---|---|---|---|
message |
data-fv-color-message |
String | The error message |
type |
data-fv-color-type |
String|String[] |
The type of color. It can be:
|
When setting options via HTML attributes, remember to
enable the validator by setting data-fv-color="true".
The message and other options can be updated on the
fly via the updateMessage() and updateOption() methods
Supported types
Following is the list of supported types:
The keyword
type accepts the following colors:
Starting with | Colors |
---|---|
A |
|
B |
|
C |
|
D |
|
F |
|
G |
|
H |
|
I |
|
K |
|
L |
|
M |
|
N |
|
O |
|
P |
|
R |
|
S |
|
T |
|
V |
|
W |
|
Y |
|
Example
Basic example
HTML5 example
The color validator will be turned on automatically if the input uses HTML 5
type="color"
attribute.
According to the W3C specification, the color input only accepts 6 hex character values. 3 hex character values as #FFF is not valid.
Color picker example
The following form uses a Bootstrap Color Picker.
Related validators
The following validators might be useful to you: