Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
simpletest.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Feb 2010 at 21:30 UTC
Updated:
14 Feb 2010 at 01:26 UTC
Jump to comment: Most recent file
Comments
Comment #2
eric_a commentedI can't do a proper review right now but I wanted to say this: for the checkbox and select element the NULL value in $input has a special meaning. This is only relevant for enabled elements but I think it would make all of the code in these functions much easier to understand if there were explicit checks for NULL rather than doing all this isset() stuff when $input !== FALSE.
Comment #3
effulgentsia commentedThis fixes the translation test, which was attempting to submit a form with input for a disabled checkbox, correctly causing a failure with the fixed handleForm() function.
I think I agree with this, but it's a separate issue, and one worth tackling after #426056: Server-side enforcement of #disabled is inconsistent, since that will decouple #disabled from $input=NULL. This patch doesn't add any new isset($input) into the mix. The only scope of this patch is to fix the test framework to not submit input for disabled elements, and to fix the form.inc code needed to make existing tests pass. The code added to form_type_select_value() follows the same structure as what's already in HEAD for form_type_checkbox_value().
As an aside, these *_value() functions are also hard to read because $input=FALSE means "return the default value if it's different from #default_value". In #622922-164: User input keeping during multistep forms, chx had written some great code to refactor this into *_default_value() functions, but that got removed from that issue in order to keep that issue focused on the problem at hand. After some of these other FAPI issues land, I'll open an issue to re-introduce this value callback / default value callback refactoring, but I have doubts that that will be accepted for D7.
Comment #4
dave reidThis is a duplicate of #335035: drupalPost() incorrectly submits input for disabled elements.