diff --git a/forms/FormAction.php b/forms/FormAction.php index 2fb01f0ee..e273a0d4e 100644 --- a/forms/FormAction.php +++ b/forms/FormAction.php @@ -80,12 +80,15 @@ class FormAction extends FormField { } function getAttributes() { + $type = (isset($this->attributes['src'])) ? 'image' : 'submit'; + $type = ($this->useButtonTag) ? null : $type; + return array_merge( parent::getAttributes(), array( 'disabled' => ($this->isReadonly() || $this->isDisabled()), 'value' => $this->Title(), - 'type' => ($this->useButtonTag) ? null : 'submit', + 'type' => $type, 'title' => ($this->useButtonTag) ? $this->description : null, ) ); diff --git a/forms/FormField.php b/forms/FormField.php index 023f6621c..29d4f8130 100644 --- a/forms/FormField.php +++ b/forms/FormField.php @@ -357,7 +357,7 @@ class FormField extends RequestHandler { $attrs = $this->getAttributes(); return @$attrs[$name]; } - + /** * @return array */ diff --git a/tests/forms/FormActionTest.php b/tests/forms/FormActionTest.php new file mode 100644 index 000000000..3e313f846 --- /dev/null +++ b/tests/forms/FormActionTest.php @@ -0,0 +1,16 @@ +assertContains('type="submit"', $formAction->getAttributesHTML()); + + $formAction->setAttribute('src', 'file.png'); + $this->assertContains('type="image"', $formAction->getAttributesHTML()); + } +} \ No newline at end of file