Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I updated a site to Drupal 7.14 today, and immediately afterward began receiving reports from users that they were unable to post comments on the site. Drupal's error log reports the following:
Illegal choice 0 in notify_type element.
I disabled Comment Notify, and the error disappeared and users are now able to successfully post comments again. Has something in Drupal 7.14 changed that Comment Notify relies upon? I tried updating to the latest Comment Notify dev release, but encountered the same error. I'm trying to track down which line of code is causing the issue, but no success yet.
Comment | File | Size | Author |
---|---|---|---|
#19 | 1560062_always_subscribe_hidden_just_kidding.patch | 1.16 KB | greggles |
#14 | i1560062-14.patch | 1.33 KB | attiks |
Comments
Comment #1
taecelle CreditAttribution: taecelle commentedSubscribe.
Same for me.
Comment #2
fenstratI can also confirm this, but same as @Keyz I cannot track down where the change that effects this was introduced in core. But this happens with drupal-7.14 and doesn't with 7.12.
Comment #3
muranod CreditAttribution: muranod commentedI am getting the illegal choice notice with the context module now, after upgrading from 7.12 to 7.14. Contexts that already existed were fine, but I cannot change, move or add any others. I just spent the evening removing all of my front page contexts and reverting to Drupal's block placement. :-(
Seems like it might be related to using Omega's Delta module, but I am not yet certain of that.It is not related to Omega's Delta module, and poss. not related to Omega at all. I cannot create a context without getting the error message.
Comment #4
jeffheaton CreditAttribution: jeffheaton commentedGetting this as well.
Comment #5
kaztur CreditAttribution: kaztur commentedSame error on 7.14. on posting/editing comments.
Comment #6
muranod CreditAttribution: muranod commentedHoping I won't have to go back to the block system - may have found what is causing this in my case. For some reason I have two context folders in \modules : context and --context (created as an on the spot backup some time ago). I didn't realize that Dupal would pick up that other folder, but looks like it's either working from that one or both. Will post back if I can fix it by deleting one of these (after making sure which one is working) Maybe both?
**UPDATE** Correcting that did not change anything. **
I'm going back to Drupal's block placement system for now.
Comment #7
fenstratThis was indeed caused in drupal-7.14 #811542-185: Regression: Required radios throw illegal choice error when none selected
Comment #8
attiks CreditAttribution: attiks commentedI posted a patch in #811542-188: Regression: Required radios throw illegal choice error when none selected, but need some contrib modules to test this
Comment #9
fenstratYep, the patch in #811542-188: Regression: Required radios throw illegal choice error when none selected fixes this issue.
Comment #10
attiks CreditAttribution: attiks commentedThis module is defining a #default_value for a radios element and setting it to FALSE, that's probably the reason of this problem, you have to use
'#default_value' => NULL
, FALSE will be interpreted as 0 (zero).Comment #11
gregglesThanks for your bug report and for helping make this a better module. Could you provide this as a patch?
Since this has better discussion I've marked #374574: Illegal choice 0 in notify_type element -An illegal choice has been detected. Please contact the site administrator. as a duplicate of this.
Comment #12
kaztur CreditAttribution: kaztur commented#9 seems has helped to me (this patch), Great Thanks!
But what about solution in module's code, but not changing core?
Comment #13
attiks CreditAttribution: attiks commented@greggles, the fix isn't straight forward, changing
define('COMMENT_NOTIFY_DISABLED', 0);
todefine('COMMENT_NOTIFY_DISABLED', NULL);
fixes the error message, but means changing the schema and providing an update function. I'm not using the module, just trying to figure out the best way to fix #811542: Regression: Required radios throw illegal choice error when none selectedEDIT: Wrong issue link
Comment #14
attiks CreditAttribution: attiks commentedPatch included, but needs some real testing
Comment #15
thumb CreditAttribution: thumb commentedAttiks, I've installed patch #14 and have tested with a few comments and replies successfully. Thanks!
Comment #16
geerlingguy CreditAttribution: geerlingguy commentedAlso works great for me; was getting that error unless a user checked the notify box, chose a value, then unchecked the notify box (or just left it checked). RTBC, please commit so people can post comments without the error :)
Comment #17
greggles@geerlingguy, did you test an upgrade path?
Comment #18
geerlingguy CreditAttribution: geerlingguy commentedAck, didn't think about that. There isn't an update added in this patch, so for now there isn't really an upgrade path...
Comment #19
gregglesThanks attiks, geerlingguy for your work on the issue.
I committed this because it helps, but it doesn't 100% solve the problem - http://drupalcode.org/project/comment_notify.git/commit/ed562bb
Not working:
* The comment's users doesn't have a personal preference set (default state - check comment_notify_user_settings in the db to see if you have one)
* You edit a comment where notifications are disabled
I plan to just always default to "COMMENT_NOTIFY_NODE" if there is more than 1 option and if the user doesn't have a preference. For editing existing nodes that is OK because the checkbox will not be checked, the JS will hide the radios for most users, and people will be none-the-wiser that the radio is actually selected.
Comment #20
gregglesPardon me, new patch needs review.
Comment #21
gregglesWell, I just accidentally committed that patch in http://drupalcode.org/project/comment_notify.git/commit/d6aacfb
If it's not what people want please re-open this issue ;)