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.

Members fund testing for the Drupal project. Drupal Association Learn more


taecelle’s picture

Same for me.

fenstrat’s picture

Priority: Normal » Major

I 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.

muranod’s picture

I 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.

jeffheaton’s picture

Getting this as well.

kaztur’s picture

Same error on 7.14. on posting/editing comments.

muranod’s picture

Hoping 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.

fenstrat’s picture

Status: Active » Closed (duplicate)
attiks’s picture

I posted a patch in #811542-188: Regression: Required radios throw illegal choice error when none selected, but need some contrib modules to test this

fenstrat’s picture

attiks’s picture

Status: Closed (duplicate) » Active

This 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).

greggles’s picture

Thanks 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.

kaztur’s picture

#9 seems has helped to me (this patch), Great Thanks!

But what about solution in module's code, but not changing core?

attiks’s picture

@greggles, the fix isn't straight forward, changing define('COMMENT_NOTIFY_DISABLED', 0); to define('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 selected

EDIT: Wrong issue link

attiks’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
1.33 KB

Patch included, but needs some real testing

thumb’s picture

Attiks, I've installed patch #14 and have tested with a few comments and replies successfully. Thanks!

geerlingguy’s picture

Status: Needs review » Reviewed & tested by the community

Also 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 :)

greggles’s picture

@geerlingguy, did you test an upgrade path?

geerlingguy’s picture

Status: Reviewed & tested by the community » Needs review

Ack, didn't think about that. There isn't an update added in this patch, so for now there isn't really an upgrade path...

greggles’s picture

Priority: Major » Critical
Status: Needs review » Needs work
1.16 KB

Thanks 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.

greggles’s picture

Status: Needs work » Needs review

Pardon me, new patch needs review.

greggles’s picture

Status: Needs review » Fixed

Well, 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 ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.