A mandatory list profile displays the first item in the list and if not selected by the user this first item will be stored.
If the list profile is set as not mandatory then it will be displayed starting with a blank (-) space. If this behavior will be applied to mandatory setting, then this will solve the problem.
In other words, how to force the user to select a country from a list if the list will be already completed with the first item?
Comment | File | Size | Author |
---|---|---|---|
#18 | profile_D6_do_not_test.patch | 905 bytes | catch |
#15 | drupal.profile-select-empty.15.patch | 952 bytes | sun |
#2 | profile.patch | 551 bytes | ralessi |
Comments
Comment #1
mariuss CreditAttribution: mariuss commentedThis is a critical bug as far as I can tell. If you look at the code, when the field is flagged as required the first option in the dropdown is supposed to be "--" and then validation should force you to select something else. See profile_form_profile, around line 395.
None of the above happens though, not sure why. Probably the required field is not set for some reason.
Comment #2
ralessi CreditAttribution: ralessi commentedI had the same issue. I made a patch to fix it. See attachment.
Robert
Comment #3
Gábor HojtsyIf you add "Please choose" as an option either way, we need code which validates you are not selecting this item. The idea behind not adding this item is that you cannot select this and forced to select one item. This is I guess a design decision after all. The current Drupal design for these required fields is to always select one item and not have a "Please select" option.
I'd say this would be a fundamental change in UI approach (but could make a lot of sense), so moving to Drupal 7 as task.
Comment #4
mariuss CreditAttribution: mariuss commentedOK, so the proper label may not be "- Please choose -", it should be "--".
I doubt this was a design decision, based on existing code looks like a plain defect. Could be wrong though.
Please keep Drupal 6 issues in Drupal 6. Even if they are never fixed, at least they are known issues. Other people running into this problem will likely find them and not enter duplicates (and also can benefit from the existing discussion or patches).
Given the existing issue tracking system isn't it better to enter a separate defect for D7? It would be great if the Version field was a multi select list box instead of a drop down. Just wondering.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedWe never open duplicates for the same issues in different branches.
Comment #6
Gábor HojtsyIssues are first fixed in the latest development version and then backported, so that we ensure that the latest development version does not bring back some of the defects, when it gets released. If you set it back to 6.x, you ensure it will not get fixed anytime soon.
Comment #7
mariuss CreditAttribution: mariuss commentedGot it, thanks.
Comment #8
totomobile CreditAttribution: totomobile commentedWas this issue ever resolved? If so is there a patch for 6.x ? Thanks
Comment #9
tumblingmug CreditAttribution: tumblingmug commentedRegarding #3: No, see this code line. If you provide an assoc. array with an empty key, this does not validate and could be utilized. So changing only 1 line of core code would let required selection lists behave "as expected" or "as normal".
Thanks.
Comment #10
tomsm CreditAttribution: tomsm commentedThanks. #9 works great!
edit: problem: It breaks the order of translated profile term. The translations are not in sync with the original terms anymore!
Comment #11
bleen CreditAttribution: bleen commentedsuperscribe
Comment #12
tumblingmug CreditAttribution: tumblingmug commentedWhat did you apply? The helper module or have you changed the line in profile core?
Comment #13
tomsm CreditAttribution: tomsm commentedFirst I changed the line in the profile core. As a result, the translations were out of sync.
Then I installed the helper module which also had some strange effects on the translations similar to that of the core modification.
But after clearing the cache and refreshing the translations it all seems to work correctly.
I do not know what caused these issues. But so far so good.
PS: I use Drupal 6.14 and Internationalization 6.x-1.2
Comment #14
catchThis needs to be fixed, but it's not critically broken.
Comment #15
sunThe fix for D7.
Comment #17
quicksketch#15: drupal.profile-select-empty.15.patch queued for re-testing.
Comment #18
catchLooks fine for D7.
Also attaching D6 backport.
Comment #19
webchickless special casing ftw.
committed and pushed to 7.x.
Comment #21
catchMarking needs review for D6.