Drupal 7.19
AT 7.x-3.1
When adding an AJAX callback to a form element in theme-settings.php, I get the following error when submitting the form or triggering the AJAX.
Fatal error: Call to undefined function at_core_settings_validate() in /includes/form.inc on line 1464
Here is the form element I'm adding.
...
$form['at-settings']['test_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Test fieldset'),
);
$form['at-settings']['test_fieldset']['test'] = array(
'#type' => 'checkbox',
'#title' => t('test'),
'#ajax' => array(
'callback' => 'test_callback',
'wrapper' => 'test-wrapper',
'method' => 'replace',
),
);
$form['at-settings']['test_fieldset']['test_wrapper'] = array(
'#type' => 'markup',
'#markup' => '<div id="test-wrapper">No</div>'
);
} // End themename_form_system_theme_settings_alter()
function test_callback($form, $form_state) {
return 'yes';
}
This code works fine in Garland and other themes. Any help would be appreciated. Thanks much.
Comments
Comment #1
Jeff Burnz commentedHmmm, not sure, try explicitly including the function:
AT calls a custom validation and submit function:
Comment #2
richardbporter commentedThat didn't work for me. Can you reproduce this or is it just something I'm doing wrong?
Not sure if the call stack would help, but ...
Thanks again.
Comment #3
Jeff Burnz commentedI haven't had time to test this, I keep meaning to but time is such a premium at the moment.
Comment #4
alisamar commentedThis Drupal core bug has been reported before. http://drupal.org/node/1296362 No progress yet
Comment #5
Jeff Burnz commented#1296362: Getting AJAX Error when handling ajax request in hook_form_alter where form element has #element_validate that comes from a them
Comment #6
richardbporter commentedThanks for the info.
Comment #7
vvvi commentedI got that error when used a 'managed_file' form element in hook_form_system_theme_settings_alter(). Resolved by adding:
Comment #8
Chipie commented@VVVi: Thanks for sharing this. It solved my problem.