Version: current

     1 <?php
     2 /**
     3  * Action that clears all fields on a form.
     4  * Inserts an input tag with type=reset.
     5  * @package forms
     6  * @subpackage actions
     7  */
     8 class ResetFormAction extends FormAction {
     9
    10     function Field() {
    11         $attributes = array(
    12             'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''),
    13             'id' => $this->id(),
    14             'type' => 'reset',
    15             'name' => $this->action,
    16         );
    17
    18         if($this->isReadonly()) {
    19             $attributes['disabled'] = 'disabled';
    20             $attributes['class'] = $attributes['class'] . ' disabled';
    21         }
    22
    23         $attributes['title'] = ($this->description) ? $this->description : ($this->dontEscape) ? $this->Title() : $this->attrTitle();
    24
    25         if($this->useButtonTag) {
    26             return $this->createTag('button', $attributes, $this->attrTitle());
    27         }
    28
    29         return $this->createTag('input', $attributes);
    30     }
    31
    32 }
    33 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -