Drupal 7 – how to add another button to a webform?

I was wondering, does anyone know how can I add another button to a webform in Drupal 7 in addition to the submit button? I tried looking through Google as well as asking this question at the Drupal forums, with no luck. Could anyone please help?

how to add apply job button as a field in drupal view

In drupal 7 View, How can add a apply job button inside the view. the job vacancy details submitted in webform. This details showed on view with apply button. I can add all fields inside the view. But

Drupal 7 How to force login before submitting webform?

I am building a form with webform … so far so good. My need is to permettre anonymous user fill in the form, but when I click on the send button, directing them to the registration page of Drupal 7

Drupal 7 Webform submit hook

I am new to Drupal(7) and hence need some help for following situations. I have created one Webform(I have other webform too) and now instead of inserting in default webform_submitted_data table, I wa

How can i add webform at specific place in drupal?

I have a webform in drupal page. I want to insert that webform at specific position in drupal with jquery. How can i place it ?

How to send attachment in e-mail in webform module in Drupal 7?

How can I receive attachment instead of link to file in e-mail in Drupal 7 WebForm?

How do I apply webform validation in drupal 7?

I have webforms in my drupal 7 website. What I want is to validate my webform fields. The webform contains a phone field which should accept numeric field and should contain 10 numbers only. Is there

How to show webform submitted data in drupal7

i want to display the webform submitted data in drupal 7 and that survey only admin can see.After the submission i want to show the submitted data to admin in table format and also wants to download t

Drupal 7 questionnaire webform

What is the best method to create a questionnaire in drupal 7. We use multiple choice questions. (+/- 20) Is it possible to have one question per page. How? Is there a way to give the user the end-sco

Drupal 7- webform : how to reset the webform submission id (sid) to 0?

I am using webform and drupal7. during testing I had created many test submissions. Now I have cleared all the submissions and all my webform tables are empty. But if I create a new submission I still

How to change the display style of webform in Drupal 7

I have made a form using Drupal 7 webform, but I want to change the display style of the form. Please let me know how to edit the display. Thanks in advance.


You can use type Markup in webform. Theme the markup as it look a like the button same as your submit button.

and write JS for that. For e.g, you want to give reset button then onclick event should empty the values in those fields. Try this.

first create markup in webform for button then use java script for that when click on this it process request based on your requirement.

Webform is a drupal form and you can use hook_form_alter: Lets say you have a custom module called mymodule and your webform id is ‘webform_client_form_XXXXX‘. Then use the sample code below.

 * Implements hook_form_alter.
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'webform_client_form_XXXXX':
      $form['actions']['custom_submit']  = array(
        '#type' => 'submit',
        '#value' => t('Custom Button'),
        '#submit' => array('mymodule_custom_submit'),
      $form['#validate'][] = 'mymodule_custom_validate';
 * Custom validation handler for your webform.
function mymodule_custom_validate($form, &$form_state) {
  // your validation code
 * Custom submit handler for your form
function mymodule_custom_submit($form, &$form_state) {
  // your submit handler code


You would have to substitute instances of mymodule in the above code with yoru modules’s name. Also i have modified the hook_form_alter a little. I suggest you move your submit button under $form[‘actions’], so it would appear next to the current submit button.

To Clear Cache:

visit /admin/config/development/performance and click on Clear all cache button.

To find the weform form-id:

This tutorial on net discuss about how to find the form id. Please note that the id used in the form tag will have ‘-‘ (hyphen), that has to be replaced with ‘_'(underscore) to get the form-id.

Another method is to print the $form_id variable in hook_form_alter ( the function which we have defined above ) and visit the webform page. If there are no other forms on that page the printed id would be the one that correspond to webform. If you enable devel module then it is easier to display debugging information using excellent krumo library.

 * Implements hook_form_alter.
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  // Below function would print out the form id in message area if devel module
  // is enabled on the site.
  switch ($form_id) {

remove dpm( $form_id ); afterwards.

Knowing the webform id is easier than the methods described above. You only need to go to: content->webforms and place the mouse cursor over the edit option belonging to the webform you want the id. Down the navigator screen the original path in the format node/id will appear. That node number is the XXX in webform_client_form_XXX.