[TYPO3-project-formidable] New renderlet SUBMITIMAGE

Manuel Rego Casasnovas mrego at igalia.com
Tue Aug 7 13:29:38 CEST 2007


Hi Luc,

Luc Muller escribió:
> I think that having a image button to submit the form is great. but the bast 
> way to have it should be inside the submit renderlet itself.
> I mean. If I add a <image> tag at the submit renderlet, then it should be 
> replaced by the image and not the submit button.
> I don't really know if it's a good idea to have many renderlets that are 
> making the same things.
>   
I think that this is a good option, I didn't think in it before.

Next I show the diff to add this new feature:

diff -ruN
ameos_formidable.orig/api/base/rdt_submit/api/class.tx_rdtsubmit.php
ameos_formidable.new/api/base/rdt_submit/api/class.tx_rdtsubmit.php
---
ameos_formidable.orig/api/base/rdt_submit/api/class.tx_rdtsubmit.php       
2007-08-07 09:52:59.000000000 +0200
+++ ameos_formidable.new/api/base/rdt_submit/api/class.tx_rdtsubmit.php
2007-08-07 13:24:19.000000000 +0200
@@ -9,7 +9,15 @@
 class tx_rdtsubmit extends formidable_mainrenderlet {

        function _render() {
-               return "<input type=\"button\" name=\"" .
$this->_getElementHtmlName() . "\" id=\"" . $this->_getElementHtmlId() .
"\" value=\"" . $this->oForm->_getLLLabel($this->aElement["label"]) .
"\"" . $this->_getAddInputParams() . " />";
+
+               if ($this->_getImage()) {
+                       $sInput = "<input type=\"image\" src=\"" . $path
. "\" name=\"" . $this->_getElementHtmlName() . "\" id=\"" .
$this->_getElementHtmlId() . "\" value=\"" .
$this->oForm->_getLLLabel($this->aElement["label"]) . "\"" .
$this->_getAddInputParams() . " />";
+               } else {
+                       $sInput = "<input type=\"button\" name=\"" .
$this->_getElementHtmlName() . "\" id=\"" . $this->_getElementHtmlId() .
"\" value=\"" . $this->oForm->_getLLLabel($this->aElement["label"]) .
"\"" . $this->_getAddInputParams() . " />";
+               }
+
+               return $sInput;
+
        }

        function _getEventsArray() {
@@ -42,6 +50,17 @@
        function _renderOnly() {
                return TRUE;
        }
+
+       function _getImage() {
+
+               $mImage = $this->_navConf("/image/");
+
+               if($this->oForm->isUserObj($mImage)) {
+                       $mImage = $this->oForm->_callUserObj($mImage);
+               }
+
+               return $mImage;
+       }
 }


> Well in a another way you couldn't you have done something like this :
>
>   <renderlet:IMAGE name="submit">
>        <path>EXT:Yourext/res/images/submit.gif</path>
>        <custom>style="cursor: pointer;"</custom>
>        <onclick>
>             <submit />
>        </onclick>
>   </renderlet:IMAGE>
I don't like this option, I prefer add the possibility to get an input
image in my HTML files.


Best regards,
   Rego

-- 
Manuel Rego Casasnovas
Computer Science Engineer
mailto:mrego at igalia.com
Tel: +34 986 10 76 10
Fax: +34 981 91 39 49
Igalia - http://www.igalia.com


More information about the TYPO3-project-formidable mailing list