Hi,

I'm working on the avatar_selection module and am re-writing the settings configuration screens. One of the new settings pages will be a 2-step multi-part form. (Step 1: select an avatar to update, step2: update properties for that avatar.) One of the properties to be updated in step 2 will be a list of roles which can use the avatar - this is done using checkboxes. It all works perfectly except for the fact that the form api seems to ignore the "#default_value" setting. This means that when the user edits an avatar they can not see the list of roles currently configured for it. The checkboxes are always unset. The exact same code used on a single-step form works as expected and the user can see the default values for the checkboxes.

I had a quick look at the form.inc code, specifically the form_builder() function. I think this is happening because checkbox_value() is not getting called as the checkbox '#value' has already been set to 0 - checkbox_value() only gets called if the value is unset. A quick hack would be to use "empty()" rather than "isset()" when checking checkbox values but I'm quite sure there must be a cleaner, neater solution.

If a patch to the forms api isn't possible, is there a workaround I can use? without having to use single-step forms!

Stella

Comments

stella’s picture

Priority: Normal » Critical

Is there a solution for this issue yet? It is the only obstacle that's preventing me from doing another release of my module. I know people are probably busy trying to get all their patches in before the D6 code freeze, but surely this is an important bug that needs to be fixed and may also affect D6 too?

I'd really appreciate if someone could take a look at this.

Thanks,
Stella

stella’s picture

Version: 5.x-dev » 5.2
drumm’s picture

Status: Active » Closed (duplicate)

There is more information here:
http://drupal.org/node/144482