[TYPO3-project-formidable] Renderlet CHECKBOX bug?

Manuel Rego Casasnovas mrego at igalia.com
Tue May 29 11:07:55 CEST 2007


Hi.

I've solved the problem redefined the methods _flatten and _unFlatten,
in my case for the class tx_rdtlistbox:
    function _flatten($mData) {
        if($this->_isMultiple()) {
            if (!is_array($mData)) {
                return $mData;
            }
            if(is_array($mData) && !$this->_emptyFormValue($mData)) {
                return implode(",", $mData);
            }

            return "";
        } else {
            return $mData;
        }
    }

    function _unFlatten($sData) {
        if($this->_isMultiple()) {
            if (is_array($sData)) {
                return $sData;
            }
            if(!$this->_emptyFormValue($sData)) {
                return t3lib_div::trimExplode(",", $sData);
                //return explode(",", $sData);
            } else {
                return array();
            }
        } else {
            return $sData;
        }
    }


With this I can use a multiple LISTBOX and I save the data into the
database and I show it.
The format data is a comma separated list like "1,2,5".

Bye,
   Rego

--
http://www.igalia.com

Manuel Rego Casasnovas escribió:
> Hello.
>
> I think that the problem is the function _getThisFormData in the class
> formidable_maindatahandler, around the lines 297 and 306.
> In this lines it's called the function _unFlatten, this is good when I
> get the data from database (it converts a list 1,5,6 in an array).
> The problem is when I want to save the data in the database, if I called
> the function _flatten in the same lines I save the data good, else I
> save the string "Array" in the database.
>
> I don't find how to solve this problem, if somebody knows how to solve
> this, I'm very grateful to him.
>
> Thanks,
>    Rego
>
> --
> http://www.igalia.com
>
>
> Manuel Rego Casasnovas escribió:
>   
>> Hi Jerome.
>>
>> I can't use the new FORMidable SVN version for the accessibility
>> problems without javascript.
>>
>> Could you talk me where is the differences between the versions related
>> with the problem in the renderlet CHECKBOX?
>>
>> Thanks,
>>    Rego
>>
>> --
>> http://www.igalia.com
>>
>>
>> Jerome Schneider escribió:
>>   
>>     
>>> Hello :)
>>>
>>> This bug has been fixed some days ago and code works fine now on SVN version
>>>
>>> Regards,
>>> Jerome Schneider
>>>
>>> Manuel Rego Casasnovas a écrit :
>>>   
>>>     
>>>       
>>>> Hi.
>>>>
>>>> I've more information.
>>>>
>>>> I think that this problem is related with the functions _flatten and
>>>> _unflatten in the class tx_rdtcheckbox.
>>>>
>>>> When the function _flatten are called the param passed is a string with
>>>> the value 'Array', and it must be a real array and not a string.
>>>>
>>>> Bye,
>>>>   Rego
>>>>
>>>> --
>>>> http://www.igalia.com
>>>>
>>>>
>>>> Manuel Rego Casasnovas escribió:
>>>>     
>>>>       
>>>>         
>>>>> Hi everyone!
>>>>>
>>>>> I'm using the CHECKBOX renderlet, I want to store the information from
>>>>> this renderlet in a database table but this doesn't work.
>>>>> The SQL query is the next:
>>>>> UPDATE tx_myext_table
>>>>> SET
>>>>> test='Array'               # Here is the problem
>>>>> WHERE
>>>>> uid = '8'
>>>>>
>>>>> I think that the correct SQL query would have to be (if the user select
>>>>> test0, test2 and test3):
>>>>> UPDATE tx_myext_table
>>>>> SET
>>>>> test='0,2,3'
>>>>> WHERE
>>>>> uid = '8'
>>>>>
>>>>> The renderlet code is:
>>>>>     <renderlet:CHECKBOX name="test">
>>>>>       <data>
>>>>>         <items>
>>>>>           <item caption="test0" value="0" />
>>>>>           <item caption="test1" value="1" />
>>>>>           <item caption="test2" value="2" />
>>>>>           <item caption="test3" value="3" />
>>>>>           <item caption="test4" value="4" />
>>>>>           <item caption="test5" value="5" />
>>>>>         </items>
>>>>>       </data>
>>>>>     </renderlet:CHECKBOX>
>>>>>
>>>>> I don't know if this is a bug or not.
>>>>> Somebody knows any solution for this?
>>>>>
>>>>> Best regards,
>>>>>    Rego
>>>>>
>>>>>       
>>>>>         
>>>>>           
>>> _______________________________________________
>>> 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
>>
>>   
>>     
> _______________________________________________
> 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