Not sure if this is a context issue or a delta issue.

Running 7.x-3.0-beta2+11-dev and 7.x-3.0-beta9.

When I try to create any context, I get the error An illegal choice has been detected. Please contact the site administrator. After running a debug backtrace on context form, I get:

An illegal choice has been detected. Please contact the site administrator.
Array
(
[0] => Array
(
[file] => /var/www/chinafile7.drupalnyc.com/public_html/includes/form.inc
[line] => 1581
[function] => drupal_set_message
[args] => Array
(
[0] => An illegal choice has been detected. Please contact the site administrator.
[1] => error
)

)

[1] => Array
(
[file] => /var/www/chinafile7.drupalnyc.com/public_html/includes/form.inc
[line] => 1628
[function] => form_set_error
[args] => Array
(
[0] => reactions][plugins][delta][delta_template
[1] => An illegal choice has been detected. Please contact the site administrator.
)

)

[2] => Array
(
[file] => /var/www/chinafile7.drupalnyc.com/public_html/includes/form.inc
[line] => 1318
[function] => form_error
[args] => Array
(
[0] => Array
(
[#type] => radios
[#title] => Select Custom theme settings template.
[#description] => There are no valid (enabled) Delta templates available.
[#default_value] =>
[#options] => Array
(
)

[#input] => 1
[#process] => Array
(
[0] => form_process_radios
)

[#theme_wrappers] => Array
(
[0] => radios
[1] => ife_form_element
)

[#pre_render] => Array
(
[0] => form_pre_render_conditional_form_element
[1] => ctools_dependent_pre_render
)

[#defaults_loaded] => 1
[#tree] => 1
[#parents] => Array
(
[0] => reactions
[1] => plugins
[2] => delta
[3] => delta_template
)

[#array_parents] => Array
(
[0] => reactions
[1] => plugins
[2] => delta
[3] => delta_template
)

[#weight] => 0
[#processed] => 1
[#required] =>
[#attributes] => Array
(
)

[#title_display] => before
[#id] => edit-reactions-plugins-delta-delta-template
[#name] => reactions[plugins][delta][delta_template]
[#has_garbage_value] => 1
[#needs_validation] => 1
[#value] =>
[#sorted] => 1
)

[1] => An illegal choice has been detected. Please contact the site administrator.
)

)

[3] => Array
(
[file] => /var/www/chinafile7.drupalnyc.com/public_html/includes/form.inc
[line] => 1275
[function] => _form_validate
[args] => Array
(
[0] => Array
(
[#type] => radios
[#title] => Select Custom theme settings template.
[#description] => There are no valid (enabled) Delta templates available.
[#default_value] =>
[#options] => Array
(
)

[#input] => 1
[#process] => Array
(
[0] => form_process_radios
)

[#theme_wrappers] => Array
(
[0] => radios
[1] => ife_form_element
)

[#pre_render] => Array
(
[0] => form_pre_render_conditional_form_element
[1] => ctools_dependent_pre_render
)

[#defaults_loaded] => 1
[#tree] => 1
[#parents] => Array
(
[0] => reactions
[1] => plugins
[2] => delta
[3] => delta_template
)

[#array_parents] => Array
(
[0] => reactions
[1] => plugins
[2] => delta
[3] => delta_template
)

[#weight] => 0
[#processed] => 1
[#required] =>
[#attributes] => Array
(
)

[#title_display] => before
[#id] => edit-reactions-plugins-delta-delta-template
[#name] => reactions[plugins][delta][delta_template]
[#has_garbage_value] => 1
[#needs_validation] => 1
[#value] =>
[#sorted] => 1
)

Comments

arcane’s picture

When i disable the Delta module, the problem goes away. I am using Omega sub theme.

seanberto’s picture

I can replicate this on the latest stable releases of Delta, Context, CTools, and an Omega subtheme.

seanberto’s picture

Interestingly, I can save a context when editing it and deleting the Delta reaction settings. But then, if no Delta reactions are set when I try to resave (or when saving a new context), it fails.

hles’s picture

Category: support » bug
Status: Active » Needs review
StatusFileSize
new2.13 KB

The problem comes from the form validation when using radios buttons because there is no value to validate/submit.

The following patch fixes the problem by always using a select instead of radio buttons or select in function of the number of templates, which I don't find really useful anyway. Patch also contains some small code formatting fixes, my IDE does that automatically, but I guess it's OK.

LiveWire’s picture

Awesome! Patch in #4 works for me. Thanks!

waverate’s picture

Patch #4 works.

Kendall Totten’s picture

Status: Needs review » Reviewed & tested by the community

Patch #4 worked for me too, thanks!!

pierremarcel’s picture

I also confirm that patch #4 works, thanks for the fix!

danny englander’s picture

The patch in #4 worked for me to fix this issue though I got these errors when I applied the patch:

error: patch failed: plugins/context/context_reaction_delta.inc:10
error: plugins/context/context_reaction_delta.inc: patch does not apply

However, in fact it did apply and when I checked my diff file in git, all the changes seemed to have applied. Thanks.

divbox’s picture

patch # 4 works for me as well. thank you!

hles’s picture

Component: Miscellaneous » Code

This solution works because it replaces radio buttons by a select. Just want to mention that there is a ongoing core issue #811542: Regression: Required radios throw illegal choice error when none selected that will eventually fix this issue without even patching delta.

DaveLindberg’s picture

Component: Code » Miscellaneous

Additional confirmation: patch #4 did the trick. Many thanks.

muranod’s picture

Any way I could get the actual patched file? I've repeatedly tried doing it myself, but can't get it to work (too new at this, I guess). I've had to disable the Context module, but I would really like to re-enable and use it.

Thanks much,

Dan

p.s. Searching brings up a number of the same error being thrown up, some for the Flag module, since the update to 7.14. Is this a core issue, a context module issue or something else?

RKopacz’s picture

Does anybody know if this patch has been committed to the dev version of Delta? I'm not too good with patches.

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.

muranod’s picture

Wondering - is it possible to go back to v. 7.13 from 7.14 until all these related issues are solved? (installing 7.13 and then running update.php).

Robin Millette’s picture

@muranod Unfortunately, update.php doesn't work in reverse.

hdennen’s picture

@muranod

I tried using cygwin for my local environment but it borked my site, ended up doing it manually.

open the patch, at the top it will say what file is being edited. Pretty sure it's modules>delta>plugins>context>context_reaction_delta.inc

make a copy for back up, then just edit the .inc file manually according to the patch file, i.e. delete where - and add where +.

bonus tip: start from the bottom so the line numbering stays correct.

Also, patch does work.

attiks’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/plugins/context/context_reaction_delta.incundefined
@@ -10,20 +10,23 @@ class context_reaction_delta extends context_reaction {
-      '#default_value' => isset($values['delta_template']) ? $values['delta_template'] : '',

This line is probably causing the problems, try changing '' to NULL

muranod’s picture

@hdenned, attiks: Awesome. I will try both of these (patching first) as soon as I can get back to my localhost site tomorrow.

Thanks so much!

Dan

dman’s picture

#19 works for me. Looks like a good fix.

muranod’s picture

I imagine I'll be more savvy at this in six months or so, but my skills aren't there yet.

Started working from the bottom up context_reaction_delta.inc / delta-context_fix_form_validation-1512744.patch

Got lost very quickly. Some of the lines with a minus are the same as the ones with a plus and all I get from the various patch tools (Windows) is error messages.

I'll wait for the next module update to try the context module again, but just wondering why patched versions aren't available somewhere ahead of an update? (dang -- I had just gotten down to my last three Drupal core-placed blocks when 7.14 came!)

Thanks for all your help everyone.

dman’s picture

Priority: Normal » Major

@muranod I appreciate that it seems - on the surface to be able to provide 'patched' versions of any and every available patch, but if you have time to look at some of the discussions that have happened before, Supplying Patched versions is by design not something that is supported for users that can't do it themselves. It frankly can drop any user into a hole too deep for them to dig themselves out of. And that not even a guru can get them out of without wiping and starting again. If you have solutions to that, see those discussions.

HOWEVER - the way forward is for a few of us to chime in, show interest, try it out (those of us who safely can) and volunteer help.
This is a patch that appears to be on the critical path (IMO anyway) and just requires maintainer fold-in.
It's allegedly stalled because a better more all-purpose patch in core may save the same problem. However, this work-around is clean, and not clutter by any means.

It does make context unusable, so I'll bump the priority - actually doing the one line patch in #19 is easier for the dev to do directly (in this case)

muranod’s picture

@dman That makes sense. I did do a full backup before 7.14 and could have restored, but it's too late to do that now because of other changes I've made. Embarrassed to admit this, but I didn't know where to put the 'NULL' value in # 19.

Glad to hear the issue is getting bumped. I'm only about 7 months into Drupal, but have found CONTEXT to be invaluable, and I also am very comfortable with Omega and the Delta module.

I would be happy to help in any way, but probably don't yet know enough to offer much.

Dan

CLEE25’s picture

Patch wasn't working for me (whitespace errors). Changing '' to NULL as outlined in #19 worked for me.

dwatts3624’s picture

Patch #4 works great!

muranod’s picture

Version: 7.x-3.x-dev » 7.x-3.0-beta9
Status: Reviewed & tested by the community » Needs work

Finally got it. Did not have to add a "NULL" anywhere. I downloaded NETBEANS and followed the three very straightforward steps here: http://drupal.org/node/60179.

Hope this helps anyone else who is having trouble patching.

Also, there are 4 versions of NETBEANS (all free, but of varying file sizes). Does anyone know the minimum version necessary to apply patches to Drupal modules? I installed the PHP version, 47MB.

CONTEXT is working fine now, and with the Delta module enabled. Thanks to everyone who helped.

Dan

attiks’s picture

Version: 7.x-3.0-beta9 » 7.x-3.x-dev
Status: Needs work » Needs review
StatusFileSize
new906 bytes

Patch for #19

klausi’s picture

Status: Needs review » Reviewed & tested by the community

#28 fixes the problem.

slucero’s picture

#28 has fixed the issue on several installations for me.

javiereduardo’s picture

#28 works for me.

doublejosh’s picture

#28 works for me as well.

traveller’s picture

#28 works for me as well.

kevinquillen’s picture

Version: 7.x-3.0-beta9 » 7.x-3.x-dev
Status: Needs work » Reviewed & tested by the community

#28 works. I think this should be rolled into a new release. All contexts are broken (for me) without it.

joemoraca’s picture

the change in 19 worked for me

kingfisher64’s picture

#4 worked for me. Rather than just applying fixes from this thread I think the calls for a new release are with merit.

attiks’s picture

Project: Delta » Context
Component: Miscellaneous » Code
Status: Reviewed & tested by the community » Needs review

Moving this to context since the patch in #28 is against context

nuez’s picture

Project: Context » Delta

Patch #28 worked for me, against Delta, moving back to delta,

seanberto’s picture

This is pretty clearly a Delta bug, nuez is right.

attiks’s picture

My bad, sorry

jdanthinne’s picture

Status: Needs review » Reviewed & tested by the community

#28 Working for me as well. Please commit.

himerus’s picture

Status: Reviewed & tested by the community » Fixed

This is now committed to 7.x-3.x-dev version and should be available in the download package... new tagged release will follow "soon".

Thank you for the report and the patch.

Status: Fixed » Closed (fixed)

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