How to remove the submit button from a specific Drupal webform

10,602

Solution 1

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

Solution 2

  1. Copy the file webform-form.tpl.php
  2. Rename it webform-form-{nid}.tpl.php where nid equals your node ID
  3. Edit - add just one line after print drupal_render($form['submitted']);,
    add this line: unset($form['actions']['submit']);

It works for me.

Solution 3

You can alter any form in drupal, using hook_form_alter.

Solution 4

If you'd like a quick fix for a prototype, etc then you could just hide the button in CSS.

.block-webform .form-actions {
visibility:hidden;
}

The invisible button will still take up a space, but you won't be able to see it.

Share:
10,602
jeremy
Author by

jeremy

Updated on June 10, 2022

Comments

  • jeremy
    jeremy almost 2 years

    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.

    • jpstrikesback
      jpstrikesback about 13 years
      You might want to go and accept some of the answers to your questions...
    • jeremy
      jeremy about 13 years
      sorry not sure what you mean? please elaborate?
    • jeremy
      jeremy about 13 years
      Never mind I know what you mean now