more quote identeiifers fixessss
[Pman.Core] / widgets / ColorField.js
1 //<script type="text/javascript">
2
3
4 /**
5 * Color field
6 */
7
8
9 Roo.form.ColorField = function(config){
10     Roo.form.ColorField.superclass.constructor.call(this, config);
11  
12    
13 };
14 Roo.extend(Roo.form.ColorField, Roo.form.TriggerField , {
15      
16      
17     defaultAutoCreate : {tag: 'input', type: 'text', size: '6',   autocomplete: 'off'},
18     
19     triggerClass : 'x-form-arrow-trigger',
20     validateValue : function(value){
21         this.setBgColor(value);
22         return true;
23     },
24     menuListeners : {
25         select: function(m, d){
26             this.setValue(d);
27         },
28         show : function(){ 
29             this.onFocus();
30         },
31         hide : function(){
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);
37         }
38     },
39     onTriggerClick : function(){
40         if(this.disabled){
41             return;
42         }
43         if(this.menu == null){
44             this.menu = new Roo.menu.ColorMenu();
45         }
46          
47         this.menu.on(Roo.apply({}, this.menuListeners, {
48             scope:this
49         }));
50         //this.menu.picker.setValue(this.getValue() || new Date());
51         this.menu.show(this.el, 'tl-bl?');
52     }, 
53     setValue: function(d) {
54         d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
55         
56         Roo.form.ColorField.superclass.setValue.call(this, d);
57         this.setBgColor(d);
58     },
59     
60     setBgColor : function(d) {
61         d = (typeof(d) != 'undefined') && d.length ? d : 'FFFFFF';
62         this.el.dom.style.background ='#' + d;
63     }
64 });