Chaitanya Lakshmi
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook

How to resolve "An illegal choice has been detected. Please contact the site administrator" error?

2/17/2012

0 Comments

 
‘#validated’ => ‘TRUE’ add this into your form elements definitions:


Example:
form['my_dynamic_select'] = array(
…
‘#type’ => ‘select’,
‘#validated’ => TRUE
…
)

Reason:
If we are using an input in AJAX related situation we will fill the input field like SELECT (dropdown) this error will shown in the interface.  Because when a value is not present in the page load will not allowed in form submission time.  So, the Drupal restricts this type of value.  This value is considered as illegal value.  Say for example an user can inject a set of value in our site and they can choose a particular value in it.

But our case is also same like injecting in sense of pushing a new set of values through AJAX.  So now and then we need to used the form field attribute "validate as True", to get a Permanent and Perfect solution too.
0 Comments



Leave a Reply.

    Archives

    April 2012
    March 2012
    February 2012

    Categor

    All
    Ajax
    Api
    Cross Site Scripting
    Css
    Curl
    Design Patterns
    Drupal
    Exception Handling
    Htaccess
    Html
    Javascript
    Jquery
    Json
    Linux
    Mysql
    Oops
    Php
    Regular Expressions
    Web 2.0
    Webservices
    Wordpress
    Xhtml

    RSS Feed

Powered by Create your own unique website with customizable templates.