Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 454b89f2bb6b4a4b4e0abd966e002fa299e4c444 1 parent fd847dd
@chillu chillu authored
Showing with 22 additions and 13 deletions.
  1. +19 −12 forms/FormAction.php
  2. +3 −1 templates/forms/FormAction.ss
View
31 forms/FormAction.php
@@ -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 @@ function Field($properties = array()) {
$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 @@ function getAttributes() {
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
4 templates/forms/FormAction.ss
@@ -1,5 +1,7 @@
<% if UseButtonTag %>
- <button $AttributesHTML></button>
+ <button $AttributesHTML>
+ <% if ButtonContent %>$ButtonContent<% else %>$Title<% end_if %>
+ </button>
<% else %>
<input $AttributesHTML>
<% end_if %>
Please sign in to comment.
Something went wrong with that request. Please try again.