I have been working to customize our maintenance page via custom template and hook_preprocess_maintenance_page(), the intent is to provide the maintenance message, some static text, as well as a basic AJAX form that allows the user to select a state, and then a specific location in that state, once they submit they will then be passed to the appropriate location outside of our site.
This is how I am handling the form:
$vars['maintenance_header'] = $vars['content'] ? "<p>" . $vars['content'] . "</p>" : "<p>System Maintenance</p>"; $vars['maintenance_content'] = "<p><span class='feature'>Don't go anywhere!</span></p>"; $maintenance_form = drupal_get_form('ajax_example_simplest'); $vars['maintenance_join_form'] = drupal_render($maintenance_form);
<?php print $maintenance_header; ?> <?php print $maintenance_content; ?> <?php print $maintenance_join_form; ?>
In building the form I noticed that when the Ajax callback fires, the contents of $vars[maintenance_header] is printed to an alert window on the screen, instead of the page being updated as I expect. To validate if this was an issue with my form specifically, I grabbed the simple ajax example which is linked below, and the behavior is exactly the same. https://api.drupal.org/api/examples/ajax_example%21ajax_example.module/function/ajax_example_simplest/7
In searching for questions around this I continue to find general ajax questions, and questions about theming the maintenance page, but nothing that covers using an ajax form within the maintenance page, so I have started this new topic to see if others have encountered this specific issue. I am wondering whether an ajax form simply won't work on a custom maintenance page or if this is related to how I am handling the form in the preprocess hook?
Thank You, Rose