When I try to save the options for my survey content type, I got the error message:

An illegal choice has been detected. Please contact the site administrator.

I've attached a PDF of the options I was trying to save. Can you tell me what's wrong?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thedut’s picture

Title: Error on saving content type options » Error on saving 'Answers content type' options

Hello Monaw,

I can not reproduce this issue.
I don't know what is wrong.
Do you still meet this issue ? Is it a permanent issue ?

monaw’s picture

I get the error even if I don't make any changes...simply clicking on "Save content type".

Yes, this is a big issue for me because I can't use it the way it is currently...your help is appreciated.

monaw’s picture

Ok, after some debugging, I found out the problem...

The error is coming from Drupal's includes/form.inc _form_validate function:

         elseif (!isset($options[$elements['#value']])) {
          form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.'));
          watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
        }

Looks like it has to do with the text format...in my case, $elements['#value'] = full_html, but there is no $options['full_html'].

Why is this module expecting a "full_html" format? It shouldn't assume. Perhaps add something to your documentation about this?

thedut’s picture

Hello,

You should test to save this page as user #1, maybe it will make the difference ?

monaw’s picture

I was user #1.

I believe the issue is that the module assumes there is a text format called "full_html" and in my site, there wasn't. I created one and that solved the problem.

thedut’s picture

Category: support » bug

Yes you right, This is a bug, I'am going to fix it !
The full_html format is provided by default on a fresh Drupal install but I guess you have deleted it.

thedut’s picture

Title: Error on saving 'Answers content type' options » Error on saving 'Answers content type' options when the input format 'full htm' does not exist
thedut’s picture

Here is the fix !
I will include it into the next release (soon !)

thedut’s picture

Status: Active » Patch (to be ported)
thedut’s picture

Status: Patch (to be ported) » Closed (fixed)

Fixed into the LimeSurvey_sync v7.x-1.3 and LimeSurvey_Sync v6.x-1.3 releases.

monaw’s picture

thanks thedut!