Using a new webform-5.x-1.3 installation, I created a form having various fields. One of them is a select drop down list with key|field values.

When using a select component (drop-down list) and the notation key|value for its options, if the & character is contained inside the key, then upon form submission, the value of this specific option is not saved in the database. I have verified this, after falsely thinking that this is an user login problem (see http://drupal.org/node/150274). The value is unaffected.

Comments

quicksketch’s picture

Thanks for the report. I've reproduced the problem and I'll try to have a look into how to correct this.

quicksketch’s picture

Status: Active » Closed (duplicate)
quicksketch’s picture

Status: Closed (duplicate) » Active

Arg, sorry that was the wrong issue. Please ignore :P

GoofyX’s picture

So, quicksketch, any progress with that? Is the latest version affected by this?

quicksketch’s picture

Yes the latest version still has the problem. :(

With all the time I've been investing in getting webform ready for Drupal 6, I hope to get this fixed soon.

GoofyX’s picture

quicksketch, brendanb has posted a patch here.

quicksketch’s picture

GoofyX, did brendanb's patch in http://drupal.org/node/215693 correct the problem fo you? If so I'd commit it right away.

GoofyX’s picture

No, I am afraid it didn't.

GoofyX’s picture

Version: 5.x-1.3 » 5.x-1.x-dev

Sorry, I forgot to mention that I tested it with the latest dev version.

brendanb’s picture

StatusFileSize
new506 bytes

Problem is similar. Not fixed by my other patch as the key|value is handled differently to standard
option values and not passed thru _webform_safe_name()

It's caused by ampersand character being POSTed back as a HTML entity. The keys then don't match.

frank&co

... becomes ...

frank&co

I might issue another patch, selected value like above won't display in email sent. Same fix necessary.
Tested and patched against current 1.x-dev.

brendanb’s picture

StatusFileSize
new886 bytes

This patch has fix for above plus fixing selected value so it's shown in email sent.

GoofyX’s picture

Confirmed. The patch in #11 works. Values are shown (and selected in the drop-down). I have not checked the e-mail though. I also noticed that in the option value attribute, the & is converted to &. I guess this is the correct behaviour, right?

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new2.54 KB

Ah, finally. Nice work brendanb. The problem was caused by the _webform_filtervalues function, which was encoding the values. Using the html_entity_decode works fine, but it'd be better not to encode them at all to begin with. This patch passes in the FALSE $strict flag into the filter function to prevent them from being encoded.

I went ahead and committed to to 1.x and 2.x, but if the problem still exists. Please reopen this issue. Thanks guys!

xqi’s picture

I am having trouble with the select field value in the email after i use the latest development release.

This is the key|value i used

China|1
US|2
China_OR_US|3

After the form is submitted, and the email will not contain the value of the user submitted for this field (blank).

Any thoughts?

quicksketch’s picture

xqi, sounds like a different problem. If your options were radio buttons, the problem was probably fixed in this issue: http://drupal.org/node/218511

Anonymous’s picture

Status: Fixed » Closed (fixed)

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