[TYPO3-project-formidable] Multiple values from LISTBOX

Luc Muller l.mul-nospam-ler at ameos.com
Wed May 16 11:06:08 CEST 2007


Well nevermind ;)

I'm going to add it in the future, because it's a not so used feature 
provided by html.
but could be very useful for some specific task.

well you could have a look at this html structure, you'll understand how it 
works :)

<select>
<optgroup label="Swedish Cars">
<option value ="volvo">Volvo</option>
<option value ="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value ="mercedes">Mercedes</option>
<option value ="audi">Audi</option>
</optgroup>
</select>

for exemple it can be useful to select a job.
lots of time you got to use two listboxes to select you job.

with the firstone you select de domain of you job (computer science, public, 
financial)
and then with the second after a refresh, you can select your job 
(developper for computer sciences, social worker for public etc.)

with the optgroup, everything can be included inside only one listbox!

Hope this helps ;)

"Manuel Rego Casasnovas" <mrego at igalia.com> a écrit dans le message de news: 
mailman.227608.1179306124.21067.typo3-project-formidable at lists.netfielders.de...
>
> Hello Luc,
>
> I didn't know the HTML optgroup, I don't need to develop this feature so
> far and I
> still don't understand very well FORMidable structure.
>
>
> Best regards,
>   Rego
>
> --
> http://www.igalia.com
>
>
>
> Jerome Schneider escribió:
>> Hi Manuel and Luc
>>
>> I used the code you provided to implement this feature in the core.
>> SVN is updated and you can find a build there:
>>
>> http://www.ameos.com/formidable
>>
>> Revision 37
>>
>>
>> Thanks for helping :) !
>>
>>
>> Best regards,
>> Jerome Schneider
>>
>>
>> Luc Muller a écrit :
>>
>>> 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
>>>>
>>>
>> _______________________________________________
>> 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