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.
Hi folks
I am currently running drupal 6.x and Mailchimp Module but got an error
"An illegal choice has been detected. Please contact the site administrator."
This problem appears when i create new user or register a new account where "Subscribe Checkbox of Mailchimp Module" is enabled at these page
For example: http://localhost/drupal/admin/user/user/create
I disable Auto Subcribe Checkbox from Mailchimp Modules and the problem disappears
This should be fixed as soon as possible
Comment | File | Size | Author |
---|---|---|---|
#7 | Picture 1.png | 19.18 KB | netsensei |
#5 | mailchimp-issue.patch | 1.63 KB | netsensei |
Comments
Comment #1
Poieo CreditAttribution: Poieo commentedSeeing this issue as well. Except I'm seeing it when interest groups are included in the registration block. With interest groups I receive the error upon registration. Without, no error.
Comment #2
levelos CreditAttribution: levelos commentedI still can't recreate. Have you tested with the latest dev snapshot?
Comment #3
Poieo CreditAttribution: Poieo commentedSeems to be working with the latest dev. The issue was with RC5.
Comment #4
levelos CreditAttribution: levelos commentedGreat, I'm closing then.
Comment #5
netsensei CreditAttribution: netsensei commentedThis is not fixed.
I installed the Mailchimp module 2.0 (july 12th) but I got the same error too. The error is also not fixed in the dev version.
Upon closer review, it seems that the
_mailchimp_subscribe_anon_form()
function builds an erroneous $form array when it comes to the INTERESTS form element. Depending on the field type, the #type property is set to either radios, checkboxes or something else. Nonetheless, the #options property is set in all cases.Apparently, the data from the listInterestGroups() call can also contain data with field type 'hidden'. The Form api doesn't allow an #options property for elements of type 'hidden'.
Hence the validation error.
Made an attempt to build a patch which works form me. But I'm not really acquainted with the MailChimp API to know what other field types (besides 'hidden', 'checkboxes' and 'radios') the call might trigger.
Comment #6
levelos CreditAttribution: levelos commentedAccording the API documentation, listInterestGroups() only returns field types of checkbox, radio, select. Under what circumstance are you getting a hidden type back? Not clear on why an interest group would presented by MC would ever be hidden, and if it was, we should just discard it entirely, e.g.,
Comment #7
netsensei CreditAttribution: netsensei commentedYes, I've just taken a look into the interface. The group is set as "Hidden". I didn't see a setting to change it into something different.
Comment #8
levelos CreditAttribution: levelos commentedTook a bit of a different approach, but fixed and committed to 6.2 branch.
Comment #10
Sinan Erdem CreditAttribution: Sinan Erdem commentedI am experiencing the same issue on the latest 7.x version. I have set some fields as hidden and not required from Mailchimp side. There are 5 of those fields. But when a user fills out a form in Drupal, it gives me 5 of those errors:
Comment #11
gcbSinan, can you clarify what sort of fields your are setting as "hidden" and how? I can only find a way to set fields as hidden when generating a Mailchimp List Form using the Mailchimp interface (/lists/designer/ on my MC account). This form has nothing to do with the Drupal Mailchimp module, though, but is instead a way to get subscribe forms embedded using nothing but basic HTML.
Also, you have tagged this under 2.9 but stated that you are on the latest version, which is 2.10. If that's true, please select the correct version in the drop-down (it's alphabetical so it shows up between 2.1 and 2.2).
Comment #12
Sinan Erdem CreditAttribution: Sinan Erdem commented@gcb,
I am sorry, I now see that I am using 7.x-2.7.
Yes, I am setting the fields (dropdown or radios) as hidden on that Mailchimp List Form. When I do that, Drupal form doesnt show those hidden items. The output of a hidden field on Drupal form becomes:
Comment #13
achilleas01 CreditAttribution: achilleas01 commentedHello,
we have added the chargebee service and the mailchimp module adds some hidden fields to the drupal form as
the following HTML code shows:
When you submit the form it produces the error
An illegal choice has been detected. Please contact the site administrator.
An illegal choice has been detected. Please contact the site administrator.
An illegal choice has been detected. Please contact the site administrator.
An illegal choice has been detected. Please contact the site administrator.
I then changed the code of mailchimp/modules/mailchimp_lists/mailchimp_lists.module
in line 532 i added this to exclude checking of these hidden fields
$tagnames = array('LNAME','SUB_HANDLE','MMERGE10','IS_TRIAL','PLAN_CODE','PLAN_NAME','SUB_SINCE','SUB_STATUS','TRIAL_END');
if(!in_array($mergevar['tag'], $tagnames)) {
and i bypass them and the error is gone.
Can you help us to find a better solution to avoid these error?
Thank you
Comment #14
gcbIt looks like this issue occurs when plugins are added to your mailchimp service? Interesting. The latest Development release (which should soon become 7.x-2.11) has configuration options to change the fields made available to anonymous users completing these forms. Can you try it out and tell us if the issue persists? if you can work around it by removing those fields on the list configuration page for anonymous-allowed lists?
Comment #15
Lukas von BlarerI encountered this error as well. Debugging revealed, that somewhere
#default_value
is being set for merge fields. If this happens for radios which was my case, this throws an error when validating because is#default_value
empty and therefore is not an allowed value. My merge field was calledstore
and therefore this inside ahook_form_alter()
solved the issue:How do we fix this?
Comment #16
ruscoe CreditAttribution: ruscoe at ThinkShout commentedWe're going to be ending support for the 7.x-3.x branch due to the upcoming deprecation of the v2.0 MailChimp API. If you're still seeing this issue with the most recent release, please feel free to reopen.