Hi,
I'm using Profile 2 ver. 7.x-1.0. (using latest version of Drupal 7.8)
If there are more than 1 *required fields that need to be selected before submitting changes or creating a profile, when you go to select an option in HS list 1, there's an error message that appears stating that 'HS list 2 field is required'.
Please keep in mind that this message will appear multiple times as you go deeper into each level of HS list 1, repeating itself stating that 'HS list 2 field is required'.
Lists are created using Term Reference/taxonomy multiple levels deep.
I searched the forums, so my apologies if this was already posted.
Please advise.
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#32 | 1275862-32_error_message_on_ajax_update.patch | 956 bytes | andypost |
#28 | 1275862-28_error_message_on_ajax_update.patch | 956 bytes | cweagans |
#21 | hierarchical_select.patch | 1.02 KB | foripepe |
#12 | 1275862.hierarchical_select.required-error.patch | 968 bytes | joachim |
Comments
Comment #1
ahwebd CreditAttribution: ahwebd commentedhaving same issue in a content type (problem is not limited to profile2)
Comment #2
Wim LeersThis is a minor problem. Patches welcome.
Comment #3
drumnjo CreditAttribution: drumnjo commentedGlad to hear it's minor, I figured as much, I look fwd to the fix...
I am also really anxious to have HS work in Views... http://drupal.org/node/1170192
This I am assuming is major issue and very important for a lot of people...?
Comment #4
Wim LeersYes. But HS Taxonomy Views is also *very* hard.
Comment #5
arcticShadow CreditAttribution: arcticShadow commentedI'm having this same issues, of error message notifying you that field is required. I may have a look at resolving this in the next few days, as it is an issue for my client. Any ideas on where to look?
Comment #6
Wim LeersProbably somewhere in HS' #process callback.
Comment #7
acbramley CreditAttribution: acbramley commentedGetting this error message as well after selecting first term in hierarchy on a required field. Does not happen when there are no children terms.
Comment #8
PapaGrandeI'm just getting into this, but I see the validation is being called at line 746 (and actually creating the error message at line 877) in form_hierarchical_select_process() in hierarchical_select.module, but it seems like it should only be validating on push of the Add button or saving the node. Does that mean changing when the callback fires?
Comment #9
RumpledElf CreditAttribution: RumpledElf commentedIt may be a minor problem but if your users are navigating to a term they want to select, they'll get an error on the page for every step of the way and it looks *really* bad ... and the average user is scared off by red message boxes.
I've got this http://drupal.org/node/1321242#comment-5234946 in my HS at the moment because it suppresses the messages but it doesn't stop the HS widget going red.
Subscribing hoping someone puts in a patch - this one is currently the only thing holding up release of a website I'm working on, although just suppressing the errors is technically enough.
Comment #10
RumpledElf CreditAttribution: RumpledElf commentedOk - had a look at the code PapaGrande mentioned that is at line 877
If you wrap this if
if ($form_state['submit_handlers'][0] !== 'hierarchical_select_ajax_update_submit') {
around the little block of code that generates the error then it won't trigger that annoying 'field required' error unless you've actually hit the submit button. I haven't tested it on preview. But it works for my usecase and I am very, very glad to see the back of 10-15 'field required' error messages every time I go grubbing around through my deeply-nested taxonomy looking for stuff.
Comment #11
sijuwi CreditAttribution: sijuwi commentedYep that works for me
Comment #12
joachim CreditAttribution: joachim commentedI can reproduce this with a single HS element, provided it's required and the form has a submit button.
It's a minor fix, but it's not a minor bug: as pointed out above users will be scared off by big red boxes and the form looks like it's not usable.
Here's the fix outlined above as a patch.
Comment #13
mortona2k CreditAttribution: mortona2k commentedCan I use this method to block warnings when I'm creating new terms? The other required fields are throwing errors.
Comment #14
ahwebd CreditAttribution: ahwebd commented@mortona2k, see http://drupal.org/node/1389740
Comment #15
ademarco CreditAttribution: ademarco commented#12 works well for me.
Comment #16
joericapens CreditAttribution: joericapens commented#12 works well for me too.
Comment #17
wimberb CreditAttribution: wimberb commented#12 fixes the Required field problem for me but it also introduces 2 new problems.
1) If I delete a taxonomy term I get an error
Notice: Undefined index: submit_handlers in _hierarchical_select_validate() (line 880 of /sites/all/modules/hierarchical_select/hierarchical_select.module).
2) If I create a new term through hierarchical select after selecting some existing terms all of the selected terms are removed from the selection.
Comment #18
odegard CreditAttribution: odegard commentedI've found a workaround.
I require users to use HS on the user registration form. I've done the following changes in hierarchical_select.module at around lines 880.
What happens here is that I check how many levels there are by counting level_labels. Don't know if this breaks down if you don't specify level labels.
If HS is a single list, then proceed as usual.
If HS is a hierarchy, then we remove the check for
Now this would work, but it let you submit the form without selecting anything, which is wrong, because the field is required.
So to fix that, I added a validation function on my user registration form like this (using hook_form_alter in a custom module):
Then in the same module I've got the validation function itself
It's not pretty, but I think it works atleast for my particular use case.
This solves the problem with deleting terms as #17 struggled with. I don't allow users to create new terms, so that I can't check, but I don't think that should be a problem either. Caveat emptor.
I think this might evolve into a general solution. I think we have to somehow count how many levels are required, and then check if that number is selected. What happens now is that validation fails after selecting one element, it doesn't take into account that you need to wait with the validation until a full hierarchy is selected.
Comment #19
ccheu CreditAttribution: ccheu commentedWimberb,
Curious, did you get any solutions to your no.1 error? i.e. did #18 work for you?
Best regards,
Chang
Comment #20
wimberb CreditAttribution: wimberb commentedHello ccheu. The error only occurred if I used the patch from #12. After reverting back to the original code the error went away. I didn't try the method outlined in #18.
Comment #21
foripepe CreditAttribution: foripepe commentedI have added a patch according to #12.
Please test it.
Comment #22
cspiker CreditAttribution: cspiker commentedPatch #12 works for me. I can't reproduce either of the errors indicated in #17.
Comment #23
sijuwi CreditAttribution: sijuwi commentedI have a interesting effect - If i create a new taxonomy term through the hierarchical select and add it to the page, when I go to save the page, it won't allow me to save. it tells me another user is working on the page. if I then refresh the apge, save it... now i have two nodes - duplicates!
Comment #24
sashken2 CreditAttribution: sashken2 commentedPatch #21 works for me. Thanks!
Comment #25
qasimzee CreditAttribution: qasimzee commented#21 worked like a charm
Comment #26
Lang Wu Jane CreditAttribution: Lang Wu Jane commented#21 works for me. Thanks!
Comment #27
lancee CreditAttribution: lancee commentedIf use HS in forms with Captcha, #21 work only for one field :( when select second-third required fields get another problem:
Have solution?
Comment #28
cweagansI say RTBC (attaching a reroll from the module root). We're using this and it fixed all of the problems we were having.
Comment #29
Kazanir CreditAttribution: Kazanir commentedcweagans this is a patch for 7.x-3.x-dev right? I can test it later tonight against my (admittedly limited) double-HS use case.
Comment #30
mvc#28 worked for me with 7.x-3.0-alpha5 (patched applied with fuzz). i vote RTBC as well.
thanks!
Comment #31
joemaine CreditAttribution: joemaine commented#28 solved the issue for me in the 2012-Jun-16 dev release
Comment #32
andypostConfirm RTBC!!! Re-roll for current 8.x
Comment #33
NancyDru+1 for #28.
Comment #34
Todd Young CreditAttribution: Todd Young commented+1 for #28 as well. Will this be rolled into a 7.x DEV release soon?
Comment #35
guillaumev CreditAttribution: guillaumev commentedCan also confirm #28 works for me !
Comment #36
Wim LeersThanks, committed #28! (But credited joachim, who AFAICT was the original author of the patch.)
http://drupalcode.org/project/hierarchical_select.git/commit/ff2573ba49a...
Comment #38
EdPhillis CreditAttribution: EdPhillis commentedThis didnt work for me on 7.x-3.0-alpha5...checked the patch was applied in the code and it was...
Comment #39
MahmoodZidan CreditAttribution: MahmoodZidan commentedThe patch (which is already committed) doesn't work.
Drupal v 7.50
module v7.x-3.0-beta7
I still get the error message "... field is required" about all the required fields in the form when choosing a taxonomy term (in my case) and adding it to the drop box.
Comment #40
MahmoodZidan CreditAttribution: MahmoodZidan commentedComment #41
GoldGiven this is now 2 years on from the last comment an I'm unable to replicate this I'm tidying the issue up.
If the issue is still extant please open a new issue and include directions to replicate that start from "Install Drupal with the Standard profile."