How to remove the submit button from a specific Drupal webform

jeremy picture jeremy · Mar 8, 2011 · Viewed 10.2k times · Source

I'd like to remove the submit button from a specific Drupal webform, is this possible and if so how do I do it?

I'd also like to remove the previous button if possible as well from the same form.

Answer

jpstrikesback picture jpstrikesback · Mar 8, 2011

You'll need to target and alter that form with hook_form_alter() as indicated by @googletop

To unset the submit, something like this in a custom module would work:

<?php
function my_custom_module_form_alter(&$form, &$form_state, $form_id) {

  if ($form_id == 'webform_client_form_130') {
    if ($thiscondition && $thatcondition){
      unset($form['actions']['submit']);
    }
  }
}
?>

Same for the "previous" button, you'll just need to find it in the form array