[TYPO3-project-formidable] Multiple values from LISTBOX
Manuel Rego Casasnovas
mrego at igalia.com
Tue May 15 09:02:47 CEST 2007
Hi,
I have modified the tx_rdtlistbox class to add this new feature, now I
can create a LISTBOX renderlet that allow me to do multiple choice. The
renderlet code is the next:
<renderlet:LISTBOX name="my_field">
<multiple>true</multiple>
<data>
<items>
<item caption="" value="" />
<item caption="A" value="0" />
<item caption="B" value="1" />
</items>
</data>
<custom>size="10"</custom>
</renderlet:LISTBOX>
To do this, I've copied the source code from renderonly tag and I've
added the next function to the class tx_rdtlistbox:
function _isMultiple() {
return ($this->oForm->_isTrue("/multiple/", $this->aElement));
}
And I've modified the _render method in this class:
if($this->_isMultiple()) {
$sInput = "<select name=\"" . $this->_getElementHtmlName() . "[]\"
multiple ";
} else {
$sInput = "<select name=\"" . $this->_getElementHtmlName() . "\" ";
}
$sInput.= "id=\"" . $this->_getElementHtmlId() . "\"" .
$this->_getAddInputParams() . ">" . $sOptionsList . "</select>";
I attach the file for this new class in this mail.
Jerome, if you want you can add this change to your classes. I think
that is a new feature that can be interesting for more people.
Best regards,
Rego
--
http://www.igalia.com
El lun, 14-05-2007 a las 10:19 +0200, Manuel Rego Casasnovas escribió:
> Hello.
>
> I want to create a form with a listbox in which you can select several
> values. I get it with the next code:
> <renderlet:LISTBOX name="var">
> <data>
> <items>
> <item caption="one" value="1" />
> <item caption="two" value="2" />
> ...
> <item caption="ten" value="10" />
> </items>
> </data>
> <custom>multiple size="5"</custom>
> </renderlet:LISTBOX>
>
> The problem is that to receive the values from this form, the
> renderlet's name must end with square brackets, something like "var[]".
> If I put square brackets at the end of the name, the renderlet isn't
> showed in my form.
>
> Some solution to do a multiple listbox?
>
> Thanks,
> Rego
>
> --
> http://www.igalia.com
>
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
More information about the TYPO3-project-formidable
mailing list