Last active
August 29, 2015 13:56
-
-
Save gbalbuena/8960156 to your computer and use it in GitHub Desktop.
This code defines a new vtype for Extjs 3 for the definition of a color value type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.apply(Ext.form.VTypes, { | |
// Color vtype definition | |
color: function(v) {return /^#(?:[0-9a-f]{3}){1,2}$/i.test(v);}, | |
colorText: 'This field must be a valid hex web color.', | |
colorMask: /[#0-9a-f]/i, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
new Ext.form.TextField({ | |
name: 'default_color', | |
fieldLabel : 'Default color', | |
xtype: 'textfield', | |
vtype: 'color' | |
}), | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment