How to remove submit button from specific Drupal web form

I want to remove the submit button from a specific Drupal web form, is this possible, and if so, how to do it?

I would also like to remove the previous button, if possible, from the same form.

+5
source share
6 answers

You need to target and change this form using hook_form_alter () as pointed out by @googletop

To disable sending, something like this in the user module will 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 just need to find it in the array of forms

+7
source
  • Copy file webform-form.tpl.php
  • Rename it webform-form-{nid}.tpl.phpwhere nid is equal to your node id
  • - print drupal_render($form['submitted']);,
    : unset($form['actions']['submit']);

.

+4
+1

.., CSS.

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

- , .

+1

php- webform-form.tpl.php, webform-form-{nid}.tpl.php webform-form-[nid].tpl.php ( ) . if - $nid, -.

print drupal_render($form['submitted']);
$arrayWithoutSubmitButton = array( 29, 30, 31, 32);
if( in_array( $nid, $arrayWithoutSubmitButton)){
    unset($form['actions']['submit']);
}
0

, Etno : - .

The only thing I would like to add to this is that the mentioned file is located in "/sites/all/modules/webform/templates/webform-form.tpl.php", NOT the file in "/ drupal / sites / all /modules/webform/templates/webform-form.tpl.php "(if you have such a file) - it took me a while to figure this out :)

0
source

All Articles