Hi,
The previous button in wizard example won't work if the form contains a required 'radios' form element which has no selected option.
It seems that previews submit is being validated although
'#limit_validation_errors' => array()
is set on the previews submit button element.
I get this error when trying :
An illegal choice has been detected. Please contact the site administrator.
To reproduce the problem, add the following code to 'form_example_wizard_location_info' function:
$form['test'] = array(
'#type' => 'radios',
'#title' => 'Test',
'#options' => array(
'1' => '1',
'2' => '2',
'3' => '3',
),
'#required' => TRUE,
);Then go to the second step of the wizard in 'examples/form_example/wizard', then without selecting any option of the radios element, click on the previous button.
Comments
Comment #1
rfayPatches are welcome. Please sort out whether you think this is a Drupal core issue or an error in this example.
Comment #2
farhadhf commentedI'm not sure, But after some digging It seems to be related to the core form API... line 1308 of form.inc, in _form_validate()
Probably depending on '#limit_validation_errors' value of the submit button an appropriate value must be sent to form_error function as the 3rd parameter ?
Comment #3
rfayWell, this bug report isn't certainly about the Examples project... it's either about your module or Drupal core. Thanks for looking into it and pursuing it.
Comment #4
farhadhf commentedThis happens when I put the code I provided in Issue summary in form_example.module, and the code does not seem to be wrong...
I created an issue on core form system.
Sorry for wasting your time :)
Comment #5
mile23Core issue is close, marking this closed.