Drupal 6 : An illegal choice has been detected.
Drupal form control can be tiresome some times, especially when developping custom modules .. In my case it was the integration of country and region select boxes from the ubercart module.
In my implementation of hook_form_alter we are adding these two elements in code :
$select_country = uc_country_select(uc_get_field_name('country'), $country, NULL, 'name');
$select_zone = uc_zone_select(uc_get_field_name('zone'), $zone, NULL, $country, 'name');
$form['country'] = $select_country;
$form['zone'] = $select_zone;But when submitting the form we have allways the same error : An illegal choice has been detected ??!!
As a solution ans reading validation from code it's possible to add in the form alter the information that this form has been already validated :
$form['zone']['#validated'] = true;
That's all !









Comments
Drupal euh
Drupal euuh ! lol
Post new comment