I'm referring to the green box that informs the user that they have successfully submitted their form. In particular, I'm wondering if I can remove it without writing any php. Is there anything in the admin interface?
-
Is there a way in your form to show a "success" page? – jasonflaherty Dec 2 '16 at 22:19
-
After submission, the page is redirected to a "success page" where we have written a "thank you for submitting" message. So, the green confirmation box is redundant. – mdb1991 Dec 2 '16 at 22:21
-
Can you / Do you want to edit the theme? – jasonflaherty Dec 2 '16 at 22:26
-
I can't personally -- that would have to go through a vendor. But at that point I would probably just use php, right? – mdb1991 Dec 2 '16 at 22:27
-
Why redirect to a success page if webform has an option to just reload the current page with the thank you message? – Ronnie Dec 2 '16 at 22:34
There is no option in Drupal's core that gives you the ability to disable messages but there is a module for that: disable_messages.
Still, I like this approach, which uses drupal_get_messages function implemented in hook_form_alter:
/**
* Implements hook_form_alter().
*/
function my_module_form_alter(&$form, &$form_state, $form_id) {
// Define the $form_id for the form which you want to suppress messages for.
if ($form_id == 'hide_messages_form_id') {
$form['actions']['submit']['#submit'][] = 'my_module_submit';
}
}
/**
* My custom submit handler.
*/
function my_module_submit($form, &$form_state) {
// Hide drupal 'status' messages. Equally use 'error', 'warning' or 'NULL'.
drupal_get_messages('status');
// Or display your own message.
// drupal_set_message(t('My message.'));
}