1 //<script type="text/javascript">
9 Roo.form.ColorField = function(config){
10 Roo.form.ColorField.superclass.constructor.call(this, config);
14 Roo.extend(Roo.form.ColorField, Roo.form.TriggerField , {
16 defaultAutoCreate : {tag: 'input', type: 'text', size: '6', autocomplete: 'off'},
17 validateValue : function(value){
18 this.setBgColor(value);
22 select: function(m, d){
29 this.focus.defer(10, this);
30 var ml = this.menuListeners;
31 this.menu.un('select', ml.select, this);
32 this.menu.un('show', ml.show, this);
33 this.menu.un('hide', ml.hide, this);
36 onTriggerClick : function(){
40 if(this.menu == null){
41 this.menu = new Roo.menu.ColorMenu();
44 this.menu.on(Roo.apply({}, this.menuListeners, {
47 //this.menu.picker.setValue(this.getValue() || new Date());
48 this.menu.show(this.el, 'tl-bl?');
50 setValue: function(d) {
51 d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
53 Roo.form.ColorField.superclass.setValue.call(this, d);
57 setBgColor : function(d) {
58 d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
59 this.el.dom.style.background ='#' + d;