Reset button is not working after previewing the webform Reset button is not working after previewing the webform.
Means when we click on preview button on webform, then on edit button of webform and then if we click on reset button. it does not work at all. What could be the reason, kindly suggest any solution?
My code is as follows :

 function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  switch ($form_id) {

    case 'webform_client_form_XYZ':
        $form['submitted']['reset'] = array(
            '#type' =&gt; 'button',
            '#value' =&gt; t('Reset'),
            '#weight' =&gt; 100,
            '#validate' =&gt; array(),
            '#attributes' =&gt; array('onclick' =&gt; 'this.form.reset(); return false;'),
        );
   }
Your code works as designed - resets form to a state it was at page load. After preview state JavaScript resets to is set to what user entered. That's not a Drupal issue, that's just how JavaScript and browsers works. Browser simply does not have that data any more - HTTP is a stateless protocol even if we work around it every day and don't even consciously notice that we do.

If you want that button to do something else, you need to use Drupal's AJAX and obtain values you want to reset to from the server directly. Alternatively, you can attach custom submit handler to that button, one that would not really submit anything, but clear data from $form_state['input'] and trigger form reappearing.