BUGFIX Fixed FormAction.ss template when used with <button> tag

This commit is contained in:
Ingo Schommer 2012-02-16 19:54:09 +01:00
parent fd847dda4d
commit 454b89f2bb
2 changed files with 22 additions and 13 deletions

View File

@ -32,16 +32,7 @@ class FormAction extends FormField {
*/
public $useButtonTag = false;
private $buttonContent = null;
/**
* Add content inside a button field.
*/
function setButtonContent($content) {
$this->buttonContent = (string) $content;
return $this;
}
protected $buttonContent = null;
/**
* Create a new action button.
@ -76,7 +67,7 @@ class FormAction extends FormField {
$properties,
array(
'Name' => $this->action,
'Title' => ($this->description) ? $this->description : $this->Title(),
'Title' => ($this->description && !$this->useButtonTag) ? $this->description : $this->Title(),
'UseButtonTag' => $this->useButtonTag
)
);
@ -93,11 +84,27 @@ class FormAction extends FormField {
array(
'disabled' => ($this->isReadonly() || $this->isDisabled()),
'value' => $this->Title(),
'type' => ($this->useButtonTag) ? null : 'submit'
'type' => ($this->useButtonTag) ? null : 'submit',
'title' => ($this->useButtonTag) ? $this->description : null,
)
);
}
/**
* Add content inside a button field.
*/
function setButtonContent($content) {
$this->buttonContent = (string) $content;
return $this;
}
/**
* @return String
*/
function getButtonContent() {
return $this->buttonContent;
}
function extraClass() {
return 'action ' . parent::extraClass();
}

View File

@ -1,5 +1,7 @@
<% if UseButtonTag %>
<button $AttributesHTML></button>
<button $AttributesHTML>
<% if ButtonContent %>$ButtonContent<% else %>$Title<% end_if %>
</button>
<% else %>
<input $AttributesHTML>
<% end_if %>