hey guys,

after some testing of webform 3.0 i run into a bug. i a user checkes the first option of a select list, this choosen option is not saved nor emailed.

can anybody help pls.?

thanks
steffen

Comments

drizzi’s picture

StatusFileSize
new33.44 KB
drizzi’s picture

i added a printscreen; a selected "HipHop" or "Kurs" nevers shows up in the email or saved submissions

quicksketch’s picture

This sounds the same as #853706: select list safe_key "0" problem after upgrade to 6.x-3.0-beta6. Unfortunately I'm having a hard time reproducing the problem.

drizzi’s picture

hey quicksketch,

for me changing from 0 to 1, 1to 2, etc. did the trick..

thanks for the hint

steffen

quicksketch’s picture

I should warn you though, if you change 0 to 1, you've changed all your results also (so any previous submissions that used to have the second choice now have the first one). If you don't use Webform for historical records that's fine, but changing 0 to 1 probably won't work for most users.

I'm still not able to reproduce this issue. Does the problem with 0 not being recorded occur on new forms for you, or is it just the ones that were upgraded?

quicksketch’s picture

Title: 1st choice of select not save nor emailed » 1st choice (keys with "0") of select options (as checkboxes) do not save nor email
Component: Miscellaneous » Code
Priority: Normal » Major

Okay, upon further testing I have been able to reproduce but only under these circumstances:

- The key of the first option must be "0" (actually it can be any item, not just the first one)
- This only affects checkboxes
- It also only affects checkboxes if you do not have the "Select or other..." option enabled on those checkboxes.

However it does affect all versions of Webform, not just upgrades. I'll have a look at this and should have it figured out shortly.

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new3.97 KB
new5.64 KB

These patches correct the behavior in both versions of Webform. Drupal 7 has some specific problems regarding setting the value of checkboxes when going back and forth between pages, but I don't want to hold up a Drupal 6 fix because of pre-existing problems with Drupal 7.

While putting this together, I found out that our test for zero-value checkboxes wasn't working correctly. Now that I've fixed it we shouldn't run into this problem again.

tomsm’s picture

Version: 6.x-3.0 » 6.x-3.1
Status: Fixed » Active

I just upgraded my live site from version 6.x-2.9 to 6.x-3.1.
I still have this issue, also see http://drupal.org/node/853706 (a duplicate of this issue).

The submitted value of the first item of a select list is always 0 when I review the result.
When I change the key value to 1 for example the item is correctly submitted.

I also use the webform validation module to verify if one of the checkboxes is selected. When I select the first option (zero as key value) the module prompts me that I have to select a value.

quicksketch’s picture

The submitted value of the first item of a select list is always 0 when I review the result.

Are you talking about a select list or checkboxes here? I don't quite understand what you mean by "the first item of a select list is always 0". You mean that a value of "0" is getting saved but it's not the right value? Could you provide a sample set of options that do not work?

I also use the webform validation module to verify if one of the checkboxes is selected. When I select the first option (zero as key value) the module prompts me that I have to select a value.

This is probably a separate bug in Webform Validation. Since the checkboxes are submitting a value of "0", it's easy to accidentally not capture the value since in PHP "0" == FALSE == NULL.

quicksketch’s picture

Version: 6.x-3.1 » 6.x-3.0
Status: Active » Fixed

There are several different issues regarding the first item being selected if the first item has a key of zero. Let's consolidate this new problem over in #885454: First item of select lists selected as default if no default is set.

tomsm’s picture

This is probably a separate bug in Webform Validation. Since the checkboxes are submitting a value of "0", it's easy to accidentally not capture the value since in PHP "0" == FALSE == NULL.

I submitted a Webform Validation issue about this:
http://drupal.org/node/886458

Status: Fixed » Closed (fixed)

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

rantebi’s picture

It looks like it's meant to be this way.
Here is a part from the drupal form api on "checkboxes":

Description: Format a set of checkboxes. #options is an associative array, where the key is the #return_value of the checkbox and the value is displayed. The #options array can not have a 0 key, as it would not be possible to discern checked and unchecked states.

taken from http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....