CCK "Option Widgets" are not functional in CCK HEAD. Fields created with an option widget (independently of the type) appears on the node editing form but are not saved in the database. Moreover, data saved was not correctly loaded and the default value form was dysfunctional.

The problem lies mostly in the logic of optionwidgets_validate(): because the validation occurs at the top-level element, we don't need to look for a parent.

Comments

yched’s picture

Patch seems to work OK for select and radios / checkbox, except selecting no value doesn't 'take' (the node keeps the previous values)
Doesn't seem to fix 'single on / off' checkboxes, though.

yched’s picture

StatusFileSize
new3.49 KB

Updated patch brings the same fix to 'single checkbox'.
Still doesn't fix the 'select no value' issue.

yched’s picture

Status: Needs review » Fixed

OK, I committed a few fixes to optionwidgets (mainly derived from the debugging work by damz), and I think the 'optionwidgets.module' part of this bug is now fixed.
Please reopen if some bugs reappear (many cases, hard to test all)

A more general problem now is http://drupal.org/node/226264 (single fields cannot be emptied)

yched’s picture

Title: Option Widgets are non-functional » noderef select not working
Status: Fixed » Active

OK, it seems nodereference select widget (which now internally uses optionwidgets) is broken
Not sure this is related to the recent changes, or if it was broken before :-)
Needs some investigation.

damien tournoud’s picture

After investigation, there seems to be (at least) two problems:

  • first, nodereference_select_validate() is called before optionwidgets_validate()
  • second, item values set with form_set_value() does not appear in $element of the parents _validate()
karens’s picture

This worked fine before, so something has changed. When I set this up nodereference validation fired *after* optionwidgets validation. The second point in #5 is true, I ran into this too (maybe sort of a bug in FAPI) so you have to use the global $form_values to get anything that might have been changed using form_set_value() previous to the current step when dealing with multiple validation operations.

I'll investigate this if I get time.

damien tournoud’s picture

The addition of the #validation option for optionwidgets_validate changed between r1.40 and r1.41 (diff). Before, it was added at the element level, but now it is added after processing.

CosmicVoyager’s picture

subscribed

karens’s picture

Status: Active » Fixed

Just committed a fix for this.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.