Closed (fixed)
Project:
Webform
Version:
6.x-3.1
Component:
User interface
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Aug 2010 at 10:31 UTC
Updated:
7 Sep 2010 at 19:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
tomsm commentedI think this has a major priority.
I will try the explain the issue better:
My user profile contains select lists.
These fields also appear in my webform and are automatically filled in with tokens %profile[key].
When a registered user fills in the webform the default value for these select lists is always the first option of the profile select list.
As a workaround I tried deleting the default value of the webform component (deleting %profile[key]) so that "Select..." would appear notifying the user that this field should be verified.
But still the first option appears.
Anonymous users do see "Select..." as it should be.
Info: I use Token 6.x-1.14
Maybe duplicate issue of http://drupal.org/node/853836#comment-3337526 ?
PS: I also tested with 6.x-3.0-beta6. The issue already existed then.
Comment #2
quicksketchUpdating title to reflect actual problem. Please keep other issues that are somewhat related closed/fixed, it's hard to track a problem if it's reported in 3 different places.
Comment #3
quicksketchI think this patch corrects the problem. A default value of "" (an empty string), was getting returned as NULL by our filtering function. As far as I could tell, this problem didn't really have anything to do with using %profile tokens, though I tested it with or without them and both seem to work fine after this patch.
Comment #4
tomsm commentedI applied the patch: The problem is partially solved.
FIXED: When I leave the default value of the component empty, the default value in the webform is "Select...".
NOT FIXED: When I set as default value %profile[profile_title], the first option is always selected as default.
My profile select list "title" has the following options: Mr., Mrs., Ms., Dr.
When I select in my user profile another option, for example "Dr.", Webform always takes the first value in the list, namely "Mr.".
My options are:
0|Mr.
1|Mrs.
2|Ms.
3|Dr.
Validation: Mandatory
Display: listbox
I also tried as options:
1|Mr.
2|Mrs.
3|Ms.
4|Dr.
The same happens with the other select list I have in my user's profile.
Maybe this problem should become a new issue?
Comment #5
quicksketchThe default value of a select list will use the "key", not the "value" part. So if you want to use %profile['profile_title'] as the default, you have to make key|value pairs like this:
Thanks for trying out the patch, I'm glad to have another edge-case fixed dealing with 0's and select lists. Let me know if this approach of new keys works for you.
Comment #6
tomsm commented@ quicksketch
Yes, the new approach works! Thanks!
Comment #7
quicksketchSuper, I've committed this patch and it will be in the next version of Webform. I expect that we should put out a new release later this week or next after additional users have upgraded. Thanks!
Comment #8
akalata commentedPatch worked for me as well. Thanks!
Comment #9
ludo.rI have a similar issue with version 3.1
The component :
Type : select
Default value : empty
Options :
0|No
1|Yes
Mandatory : yes
Listbox : yes
Option "No" is already selected and there is no "Select..."
Comment #10
quicksketchThis problem is in the 3.1 version (as noted in the "version" property in the original report). It has been fixed and will be included in 3.2.
Comment #11
ludo.rOh sorry, i didnt get that!
Thanks!
Comment #12
roball commentedCan confirm this issue with 3.1. It occurs always when no default has been set, regardless of key values (for example, if you use the module-provided list of all countries, Afghanistan is always preselected as default).
Can also confirm that the patch of #3 solves the problem :-) Thanks!
Comment #14
roball commentedThanks for the fix which is now in 3.2. Working fine.