diff options
Diffstat (limited to 'modules/simpletest/tests/form_test.file.inc')
-rw-r--r-- | modules/simpletest/tests/form_test.file.inc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/simpletest/tests/form_test.file.inc b/modules/simpletest/tests/form_test.file.inc index 96681eaa8..808863ede 100644 --- a/modules/simpletest/tests/form_test.file.inc +++ b/modules/simpletest/tests/form_test.file.inc @@ -13,11 +13,17 @@ function form_test_load_include_menu($form, &$form_state) { // Submit the form via AJAX. That way the FAPI has to care about including // the file specified in hook_menu(). + $ajax_wrapper_id = drupal_html_id('form-test-load-include-menu-ajax-wrapper'); + $form['ajax_wrapper'] = array( + '#markup' => '<div id="' . $ajax_wrapper_id . '"></div>', + ); $form['button'] = array( '#type' => 'submit', '#value' => t('Save'), '#submit' => array('form_test_load_include_submit'), '#ajax' => array( + 'wrapper' => $ajax_wrapper_id, + 'method' => 'append', 'callback' => 'form_test_load_include_menu_ajax', ), ); @@ -32,9 +38,12 @@ function form_test_load_include_submit($form, $form_state) { } /** - * Ajax callback for the file inclusion via menu test. We don't need to return - * anything as the messages are added automatically. + * Ajax callback for the file inclusion via menu test. */ function form_test_load_include_menu_ajax($form) { + // We don't need to return anything, since #ajax['method'] is 'append', which + // does not remove the original #ajax['wrapper'] element, and status messages + // are automatically added by the AJAX framework as long as there's a wrapper + // element to add them to. return ''; } |