Radio elements' #return_value attributes do not need to be run through check_plain() in form_process_radios(), since the attribute is ultimately output by drupal_attributes(), which runs all attribute data through check_plain() itself.

This messes up any javascript that looks at form element values--probably #states and definitely ctools form dependencies (#958608: Dependendcy does not work with option "<=").

Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, radio_values.patch, failed testing.

becw’s picture

Status: Needs work » Needs review
FileSize
1.21 KB

Checking for actual equivalency this time...

Status: Needs review » Needs work

The last submitted patch, 971120-2-radio_values.patch, failed testing.

becw’s picture

Status: Needs work » Needs review
FileSize
1.24 KB

Absolute equivalency wasn't the issue--need to check whether the element has a value or not. Thx simpletest!

dawehner’s picture

FileSize
2.96 KB

Here is patch with a test. But sadly this testcase in general fails here, let's see what the testbot says.

bojanz’s picture

The test without the fix fails, as it should.
Let's see if the testbot is still happy with the patch.

#5: 971120-5-radio_values.patch queued for re-testing.

bojanz’s picture

FileSize
3.58 KB

Great, the bot still likes it!

Rerolled anyway, adding commas at the end of newly added array elements, and eliminating the offsets while I'm at it.

+1 for RTBC.

bojanz’s picture

chx pointed me to #954628: "An illegal choice has been detected" when a radio/checkbox option key contains a quote character.
The fix for radio buttons in that issue is the same one as the one in this patch, except that this patch also has tests.
Before that issue can be closed and this one committed, we need to see what should be done with checkboxes, since they might have a similar bug of their own.

bojanz’s picture

bojanz’s picture

Priority: Normal » Major

Increasing priority, would be really good to fix this before the release since it affects Views.

bojanz’s picture

FileSize
4.1 KB

chx reviewed the patch on IRC, requested more comments. Added.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

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