An illegal choice has been detected in drupal select field|Bypass validation for ajax loaded options

11 years ago, February 4, 2013
Reading time: 1 mins

 

If u have ever tried  to use ajax to load dynamic options in select field (dropdown, checkbox, radio) in drupal form. You must have seen this error.

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

All you have to do to solve this problem is to bypass the validation for the field.

'#validate' => true

this will bypass the core's validation on the field and lets you choose any value in the field other than you have used as key value pair in backend.

 Using Auto load on scroll of table select will give same error. '#validate' => true doesnt solve the problem here. If anyone has done auto load of table select rows with ajax and made the bulk operations work please help me.

Previous
CSS to align center the drupal pager
Next
How to unlock Android phone after too many pattern attempts without factory reset
© 2024 Anil Maharjan