Yii 1.1: colorpicker

jQuery based color picker input widget
7 followers

EColorPicker is an input widget with a color picker palette which is jQuery based. You can consider this Yii widget as a wrapper for that jQuery plugin.

Current version: 1.6

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions

Usage

See the following code example:

$this->widget('application.extensions.colorpicker.EColorPicker', 
              array(
                    'name'=>'cp',
                    'mode'=>'textfield',
                    'fade' => false,
                    'slide' => false,
                    'curtain' => true,
                   )
             );

There are 3 modes for the plugin: flat, selector and textfield. The most useful mode is textinput, since it places the color in a text input field of a form, which can be read using $_POST.

In textfield mode you can use 3 kind of effects to display the palette in a fancier way: fade, slide and curtain. Just set the desire effect to true in the widget's parameters. You can also adjust the delay of the effect by using the timeFade, timeSlide and timeCurtain parameters.

You can pass a starting color value by setting the value parameter to an hexadecimal RGB value.

Change Log

Updates

20081225

  • Version 1.6 - Changed the way the name attribute is generated.

20081207

  • Version 1.5 - Fixed a javascript bug which prevented to run on MSIE 6/7

20081207

  • Version 1.4 - This should have been uploaded on 20081203, $value must be public, not private.

20081205

  • Version 1.3 - Fixed bug which prevented the correct URL generation under Windows(tm)

20081203

  • Version 1.2 - Using value instead of color (which was redundant :S )

20081202

  • Version 1.1 - Fixed bug: the id used for the element was changed and could not be easily retrieved with $_POST

Total 4 comments

#16957 report it
Vulkodava at 2014/04/16 10:21am
Question about rebinde the widget after an Ajax Reload

Hi, I need to use this widget after an Ajax call has regenerated the content in which is this widget. There is no JS errors but I still cannot use the widget. The value of the input field is taken into account but onClick event does not open the color picker. Can you help?

P.S. Some additional info. The Ajax call goes via renderPartial.

#4641 report it
yiiz at 2011/07/28 09:13pm
new version

the ColorPicker plugin has a new version release on 23/05/2009 you can find here

download the new version, and then replace the "colorpicker.js"

#4181 report it
starsw001 at 2011/06/14 03:24am
颜色选择器。

这个功能不错。

#1908 report it
sebas at 2008/12/17 02:45pm
It works like a charm

Fast and easy integration!

Excelent extension!!

Leave a comment

Please to leave your comment.

Create extension