5319 Posts in 1593 Topics by 1165 members
|Go to End||Next >|
27 March 2009 at 11:30pm Last edited: 3 February 2010 11:48am
I'd like to integrate a Color-Picker into the SilverStripe CMS. It should behave like a regular form-input field, but open a color-picker dialog whenever the user clicks it. Much like the CalendarDateField
I was wondering if something like this has been done by anybody and if not, whether or not I should use jQuery (or still use Prototype?) to implement it.
Any input is appreciated.
Thanks - Roman
The latest version of this module can be downloaded here: http://bummzack.ch/colorpicker (scroll down for installation instructions and download link)
28 March 2009 at 12:58am
Not aware of anyone here who have done it. Use jQuery - the goal is to do all new development in jQuery and drop prototype over time.
Look forward to seeing the result!
28 March 2009 at 3:59am Last edited: 28 March 2009 4:18am
Alright. This one was rather quick and painless
Thanks to the awesome jQuery ColorPicker Plugin, provided by
Here's how this looks in the CMS (also works in a CMS-Popup):
Sources are attached to this post. Just extract to your SilverStripe Directory (like a module).
Usage (example for getCMSFields):
$fields->addFieldToTab('Root.Content.Main', new ColorField('BgColor', 'Background Color'));
The only thing that doesn't work is my custom "Disabled" class. I'd like to show the color when the form-field is rendered as disabled but I wasn't able to get it working. Maybe somebody can shed some light on this? What else has to be done, other than creating a class named "ColorField_Disabled". Do I have to "wire" it to the ColorField class somehow?
Have fun - Roman
Edit: Oh yeah forgot to add: So far this was only tested in SilverStripe 2.3.1 RC2. It relies on jQuery so most likely it won't work out of the box in SilverStripe 2.2
Edit 2: Grrr. Fixed a validation issue. Uploaded the updated files as colorpicker2.zip. Somehow the removal of attachements doesn't seem to work.
28 March 2009 at 4:48am
That rocks. I love it. Be sure to submit to SS as soon as it's stable. I'm sure I'll find a use for this somewhere along the line.
26 May 2009 at 6:18am Last edited: 26 May 2009 6:28am
I've tried it in 2.3.1 and 2.3.2 rc1
Thanks in advance
EDIT: The validation is working so the field it self is behaving, it's just the jquery colorpicker that isn't working.
26 May 2009 at 9:04am Last edited: 26 May 2009 9:05am
I just attached my most recent version to this post... it works with 2.3.1 here.
26 May 2009 at 10:53am
Perfect, that did the trick, I guess it was the missing js file.
It's a great addition, just what I needed, thanks!
|Go to Top||Next >|