This field is a wrapper around the YUI ColorPicker widget.
Use the following code to create a basic inputEx ColorPickerField.
1 | new inputEx.ColorPickerField({parentEl: 'container1', label: 'Choose a color', description: 'Click to view the available colors' }); |
view plain | print | ? |
Use the following code to create a ColorPickerField without controls
1 | var field = new inputEx.ColorPickerField({parentEl: 'container2', label: 'Choose a color', value:'#2626AF', colorPickerOptions:{showcontrols:false} }); |
2 | |
3 | // Register the 'updatedEvt' and log the value to the page |
4 | var logDiv = inputEx.cn('div', null, null, "Log :"); |
5 | YAHOO.util.Dom.get('container2').appendChild(logDiv); |
6 | field.updatedEvt.subscribe(function(e,params) { |
7 | var val = params[0]; |
8 | logDiv.appendChild( inputEx.cn('div', null, null, "Updated at "+(new Date())+" with value: "+val) ); |
9 | }); |
view plain | print | ? |