How to add reset button in webform? I tried to use below code to add reset button in webform,but its not working.I think that is not calling to "contact_form_reset" this function.Please help me out..

function cap_academy_contactus_form_alter(&amp;$form, &amp;$form_state, $form_id) {
       if ($form_id == 'webform_client_form_860'){
        $form['actions']['reset'] = array(
          '#type' =&gt; 'submit',
          '#value' =&gt; t('Reset fields'),
          '#submit' =&gt; array('contact_form_reset'),
          '#prefix' =&gt; '&lt;div class="contactform"&gt;',
                '#suffix' =&gt; '&lt;/div&gt;'   
        );
        return $form;
      }
    }

    function contact_form_reset($form, &amp;$form_state){
      $form_state['rebuild'] = FALSE;
    }
You should use #button_type and #attributes onclick  like this.


$form['reset'] = array(
    '#type' => 'button',
    '#button_type' => 'reset',
    '#value' => t('Reset'),
    //'#weight' => 9,
    //'#access' => FALSE,
    //'#disabled' => TRUE,
    '#validate' => array(),
    '#attributes' => array(
          'onclick' => 'this.form.reset(); return false;',
        ),
    '#prefix' => '',
    '#sufix' => '',
);


Another option is to use Ajax like this.In the callback we can reset all form elements to default.I tried using $form_state['rebuild'] in there but it didn't work in my case.


 $form['reset'] = array(
     '#type' => 'button',
     '#value' => t('Reset all'),
     '#ajax' => array(
         'callback' => 'my_ajax_reset_all',
     ),
     //'#limit_validation_errors' => array(''),       // No validation.
);