[TYPO3-project-formidable] Multiple values from LISTBOX

Luc Muller l.mul-nospam-ler at ameos.com
Tue May 15 09:51:45 CEST 2007


Hi Manuel.

Thanks for this small addition to formidable.
It's great to see that peoples are involved in the project :)

The multiple choice listbox is something that should have been implemented 
inside formidable sometimes ago, but, for now, it was just a missing 
feature.

We just forgot to put it in :p

I think jerome is going to get that inside Formidable Core.

For Now I'm think of something else.

You allow people to select multiple option in listbox.

Did you think about adding the possibility to display <optgroup> ?

This is not really used inside a lot of project, but it can be useful when 
listboxes are really big.

As you were modifying the listbox renderlet, may you have a look at this 
point and see what's possible with this.

By our side, we are working on totaly other aspect on formidable at the 
moment, but it's gonna be a next feature, I'll Add it right now in the todo.

Thanks a lot :)

"Manuel Rego Casasnovas" <mrego at igalia.com> a écrit dans le message de news: 
mailman.224377.1179212570.21067.typo3-project-formidable at lists.netfielders.de...

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