Closed (duplicate)
Project:
Drupal core
Version:
9.4.x-dev
Component:
forms system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Nov 2011 at 03:50 UTC
Updated:
20 Jun 2022 at 12:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mikeker commentedCrap... Git just barfed on me. I'll upload the promised patch as soon as I can.
Comment #2
mikeker commentedAttached patch fixes the comparison issue and adds test
Comment #4
mikeker commentedClearly it was too late last night for me to be submitting patches... After this morning's coffee is seems obvious that, as with #654796: Identify fix bugs with checkbox element, casting to string is the way to go.
As before, TRUE, 1, and '1' are equal, as are FALSE, 0, and '0'. My only concern is that
(string)'' == (string)FALSE... Suppose you had a form similar to:That currently results in both "Don't care" and "not published" being marked as checked though browsers only respect the last checked attribute in a radios group. The attached patch would only mark "Don't care" as checked.
Comment #5
mikeker commentedComment #6
OnkelTem commentedI've just faced the exact same problem when Better Exposed Filters were checking "No" where "All" was the case.
I initially replaced == with === but then found this issue which is indeed more elaborated.
Applying it to my setup now.
Comment #7
gaëlgIt also worked for me.
Comment #8
David_Rothstein commentedNeeds to go in Drupal 8 first.
Comment #9
W.M. commentedI confirm that as per Drupal 7.21 the patch under #4 (by mikeker) solved an issue while using BEF module. I do not know if the patch found its way into the most recent official releases of Drupal 7.
Comment #10
mikeker commented@Geir19, as per #8, this needs a patch for D8 (which I'm working on today as part of a D8 sprint) before it can be backported to D7.
Comment #11
mikeker commentedAdded the same type juggling tests for radio buttons as exist currently for checkboxes. (Also generalizes two checkbox-specific helper functions). Testbot should fail on the new radio button tests.
Comment #12
mikeker commentedAnd the fix originally proposed in #4. Interdiff is from #11.
Comment #13
mikeker commentedre: #MWDS2013 -- joining the sprint remotely from Seattle. :)
Comment #14
mikeker commentedWhoops, missed one.
Comment #16
mikeker commentedRan out of time in this sprint -- will come back to this in the next few days.
Comment #17
W.M. commentedThank you, I wish you good luck.
Comment #17.0
W.M. commentedfixed bogus code filter issues
Comment #18
mgiffordComment #19
mikeker commentedMarking #2165639: Patch must be applied to includes/form.inc to make BEF work properly as postponed on this.
Comment #20
joelpittetCrusty jugglers!
Comment #21
rudiedirkx commentedAny chance this will ever be fixed in D7? It's been fixed for 3.5 years...
Comment #22
mikeker commented@rudiedirkx: This needs to be fixed in 8.x first and then backported. Until then, you'll need to keep applying the patch in #4 with each core update.
Comment #23
mikeker commented... and the first step would be a reroll against the latest 8.0.x HEAD.
Comment #24
joelpittetHere's a re-roll and a fix all the things and update to latest way to deal with FAPI.
The tests pass locally but definitely needs a good review of the tests!
Added a tests only patch because I'm curious if this actually fixes anything in D8;)
Comment #25
joelpittetComment #28
joelpittetWell the 9 test failures are expected in the tests-only. The 40 test failures were not expected. With a manual test I am getting back what I'd expect.
Comment #29
joelpittetProbably don't need the value callback in there for radios. This may still fail, but hopefully less (my guess is by half)
Comment #31
martin107 commentedNothing of significance.
While reading up on this issue, I noticed 2 small cosmetic nits, so the error count will be unchanged.
No need to trigger testbot ....yet.
Comment #32
joelpittettestbot, and thank you for the nits.
Comment #37
joelpittetRerolling
Comment #39
martin107 commentedAgain just minor nits found while reading along..
@file tags are deprecated.
Converted a few cases of t() into $this->t()
Comment #49
lendudeThis reads like a duplicate of #1381140: A #default_value = 0 for #type radios checks all radios which was fixed around the time development here stopped.
If you feel there is still work here that needs to be done, please feel free to re-open this.