2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-01-09 05:18:36 +01:00
|
|
|
/**
|
|
|
|
* Action that clears all fields on a form.
|
|
|
|
* Inserts an input tag with type=reset.
|
|
|
|
* @package forms
|
|
|
|
* @subpackage actions
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class ResetFormAction extends FormAction {
|
|
|
|
|
|
|
|
function Field() {
|
2008-08-11 02:21:44 +02:00
|
|
|
if($this->useButtonTag) {
|
2009-02-02 00:49:53 +01:00
|
|
|
$attributes = array(
|
|
|
|
'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''),
|
|
|
|
'id' => $this->id(),
|
|
|
|
'type' => 'reset',
|
|
|
|
'name' => $this->action
|
|
|
|
);
|
|
|
|
|
|
|
|
if($this->isReadonly()) {
|
|
|
|
$attributes['disabled'] = 'disabled';
|
|
|
|
$attributes['class'] = $attributes['class'] . ' disabled';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->createTag('button', $attributes, $this->attrTitle());
|
2008-08-11 02:21:44 +02:00
|
|
|
} else {
|
2009-02-02 00:49:53 +01:00
|
|
|
$attributes = array(
|
|
|
|
'class' => 'action' . ($this->extraClass() ? $this->extraClass() : ''),
|
|
|
|
'id' => $this->id(),
|
|
|
|
'type' => 'reset',
|
|
|
|
'name' => $this->action,
|
|
|
|
);
|
|
|
|
|
|
|
|
if($this->isReadonly()) {
|
|
|
|
$attributes['disabled'] = 'disabled';
|
|
|
|
$attributes['class'] = $attributes['class'] . ' disabled';
|
|
|
|
}
|
|
|
|
|
|
|
|
$attributes['title'] = ($this->description) ? $this->description : ($this->dontEscape) ? $this->Title() : $this->attrTitle();
|
|
|
|
|
|
|
|
return $this->createTag('input', $attributes);
|
2008-08-11 02:21:44 +02:00
|
|
|
}
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|