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 , {
17 defaultAutoCreate : {tag: 'input', type: 'text', size: '6', autocomplete: 'off'},
19 triggerClass : 'x-form-arrow-trigger',
20 validateValue : function(value){
21 this.setBgColor(value);
25 select: function(m, d){
32 this.focus.defer(10, this);
33 var ml = this.menuListeners;
34 this.menu.un('select', ml.select, this);
35 this.menu.un('show', ml.show, this);
36 this.menu.un('hide', ml.hide, this);
39 onTriggerClick : function(){
43 if(this.menu == null){
44 this.menu = new Roo.menu.ColorMenu();
47 this.menu.on(Roo.apply({}, this.menuListeners, {
50 //this.menu.picker.setValue(this.getValue() || new Date());
51 this.menu.show(this.el, 'tl-bl?');
53 setValue: function(d) {
54 d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
56 Roo.form.ColorField.superclass.setValue.call(this, d);
60 setBgColor : function(d) {
61 d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
62 this.el.dom.style.background ='#' + d;