Posted by artwork on June 15, 2009 at 8:41am
| Project: | Colorpicker |
| Version: | 6.x-2.0-rc3 |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | thinkyhead |
| Status: | closed (fixed) |
| Issue tags: | cck fields |
Issue Summary
I add colorpicker field as cck field and it is "NOT required field" this is where error came.
'' is not a valid hex color
The default value is invalidWhy should I set default if I don't required this field I think I should have a choice to leave it blank.
This also happen in node/add when I try to create node it asked me to fill the color, I use unlimited filed, so it end up I have to put at least two color to add a node (unlimited field has two default field).
Comments
#1
I have the same problem, it seems to work properly if you avoid multiple values.
#2
I'll fix this this week
#3
#4
subscribing
#5
thank you! looking forward to the official 2.0 release party
#6
This patch fixes the validation bug
#7
Hmm, I applied the patch, and it does remove the validation error. However, now when I submit a node with an empty colorpicker value it automatically sets it to #FF0000.
#8
Isn't that the default value specified in the Content Fields settings page? Did you try leaving that empty?
#9
Yeah, the default value is blank for the content field settings field. Not sure where the FF0000 is coming from.
#10
In line 155 & 173 the default value is set if the existing value is not set.
So all existing items will default to NULL (empty string) and the new values to '#FF0000'. [If I'm reading the code correctly.]
Big +1 to not having any defaults in code! It is a pain to set the defaults on all colorpicker fields
The attached patch removes the default value along with the changes to the required / empty values as per the patch above
#11
AFAIK, CCK takes care of handling the required check.
The problem is that validation should only take place when a non-empty value has been entered. For the Colorpicker widget, the empty value is "#". colorpicker_cck_field() compares the submitted value to "#", but colorpicker_textfield_process() has already replaced the single "#" with "".
#12
Applied the latest patch.
#13
Automatically closed -- issue fixed for 2 weeks with no activity.