[TYPO3-project-formidable] Comment / questions and perhaps a solution to bug 10631 (Duplicate ID in renderlet:LISTER)

Hauke Hain newgrp at googlemail.com
Sat Mar 7 09:52:08 CET 2009


Hi,

this thread refers to the following bug:
0010631: Not XHTML valid code: Duplicate ID in renderlet:LISTER
http://bugs.typo3.org/view.php?id=10631


I pointed out where the double ID is set:
function &_refineRow(&$aRow)
    function renderReadOnlyWithForcedValue
        function _renderReadOnly()

in line 382:
$sPostFlag = "<input type=\"hidden\" id=\"" . $this->_getElementHtmlId() . 
"\" name=\"" . $this->_getElementHtmlName() . "\" value=\"1\" />";

It would be a simple solution to add some charakter to avoid the double id:
$sPostFlag = "<input type=\"hidden\" id=\"" . $this->_getElementHtmlId() . 
"Input\" name=\"" . $this->_getElementHtmlName() . "\" value=\"1\" />";


Another possibility (I prefer it) is to change the id name in
function wrapForReadOnly($sHtml)
line 407


I have a few questions regarding this problem:
Does formidable need the hidden inputs and the span-Tags generated by
function _renderReadOnly() -> $sPostFlag
function wrapForReadOnly($sHtml)
?
And for what does it need it?

I prefer the code generated if I change line 382 from
$sCompiled = $this->wrapForReadOnly($mHuman) . $sPostFlag;
To
$sCompiled = $mHuman;

It is less HTML-Code, so the page can be faster loaded if there are pretty 
big lists and I do not notice any different behaviour of formidable. 
Everything seems to work fine.


However, because I don't need the tags and perhaps somebody else also, I 
made a few adjustements to set via the XML-file if thehidden input-fields 
and the span tags should be generated:


ameos_formidable\api\class.mainrenderlet.php:
Replace line 370 with (", $humanOnly" is added):
function renderReadOnlyWithForcedValue($mValue, $humanOnly) {

Replace line 377 with ("$humanOnly=0" is added):
function _renderReadOnly($humanOnly=0) {


Replace line 383 ("$sCompiled = $this->wrapForReadOnly($mHuman) . 
$sPostFlag;") with the following:

   if ($humanOnly) {
        $sCompiled = $mHuman;
      } else {
        $sCompiled = $this->wrapForReadOnly($mHuman) . $sPostFlag;
      }



ameos_formidable\api\base\rdt_lister\api\class.tx_rdtlister.php:
Add the following function to the class:

  function humanOutputOnly() {
    if ($this->_navConf("/template/nospanandhiddeninput") === TRUE)
      return TRUE;
    return FALSE;
  }

Replace line 1299
$this->aOColumns[$sName]->renderReadOnlyWithForcedValue($aRow[$sName]),

With
$this->aOColumns[$sName]->renderReadOnlyWithForcedValue($aRow[$sName],$this->humanOutputOnly()),


Replace line 1325
$this->aOColumns[$sName]->renderReadOnlyWithForcedValue($mValue),

With
$this->aOColumns[$sName]->renderReadOnlyWithForcedValue($mValue,$this->humanOutputOnly()),



In your XML-file you may set
   <template noSpanAndHiddenInput="True"/>
in <renderlet:LISTER>



It would be great if you can fix the bug on a way formidable likes it.
And I would really appreciate it, if formidable gets the ability like 
"noSpanAndHiddenInput" in a upcoming SVN version.


Kind regards,
Hauke 



More information about the TYPO3-project-formidable mailing list