[TYPO3-project-formidable] Fwd: conditional appearance & others questions

Jerome Schneider j.schneider at ameos.com
Fri Jul 13 16:01:41 CEST 2007


Hello Aurelien,

1 - first, an easyier way to build dynamic data:

Your userobj'PHP code for building dynamic data for a radiogroup works, 
but you can do the same in a simpler way, like this:

<userobj>
	<php><![CDATA[

	return $GLOBALS["TYPO3_DB"]->exec_SELECTgetRows(
		"uid as value, access_name as caption",
		"tx_manageguest_access_to_service",
		"pid=83"
	);

	]]></php>
</userobj>






2 - Displaying a renderlet when choosing an item in radio list

Or, more generaly, executing something when the user do something
We're talking about event handling there.
See http://wiki.typo3.org/index.php/Formidable_documentation#Events
And http://www.ameos.com/formidable/features/events.html


So basically:
	1 - you need to place an event on the onchange for the list of choice
	2 - the event will check if the selected value is "other", and if it 
is, will display the box containg your checbox, otherwise hidden

Note: the event management is not complete on renderlet:RADIOBUTTON for 
the moment, so you'll have to use a LISTBOX instead, as in the following 
example :

<renderlet:LISTBOX name="radiolist" label="How many do you want ?">
   <data>
     <items>
       <item caption="One" value="one" />
       <item caption="Two" value="two" />
       <item caption="Three" value="three" />
       <item caption="More" value="more" />
     </items>
   </data>
   <onchange runat="ajax" params="radiolist" cached="true">
     <userobj>
       <php><![CDATA[

     $aParams = func_get_arg(1);

     if($aParams["radiolist"] === "more") {
       return $this->aORenderlets["container_more"]->majixDisplayBlock();
     } else {
       return $this->aORenderlets["container_more"]->majixDisplayNone();
     }

       ]]></php>
     </userobj>
   </onchange>
</renderlet:LISTBOX>

<renderlet:BOX name="container_more" custom=" style='display: none;' ">
   <childs>
     <renderlet:BOX html="This is displayed when 'More' is selected" 
mode="h2" />
     <renderlet:CHECKSINGLE name="checkbox_autre" label="I want a lot 
more !" />
   </childs>
</renderlet:BOX>






3 - Validation of required fields

You have to use validators inside your renderlets
See http://wiki.typo3.org/index.php/Formidable_documentation#Validators





Hope this helps, and welcome to the community :)

Jerome Schneider

Aurélien Allienne a écrit :
> Hi,
> 
> I begin with FORMidable and I think it's a great tools :)
> 
> But in my training, i have some questions with no responses :
> 
> First :
> I have a RADIOBUTTON like this :
> <renderlet:RADIOBUTTON name="access" label="Service :">
>                        <data>
>                        <userobj>
>                        <php><![CDATA[
>                                $res =
> $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,access_name','tx_manageguest_access_to_service', 
> 
> 'pid=83');
>                                $aItems = array();
>                                while($row =
> $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
>                                        $aItems[] = array(
>                                                "caption" =>
> $row["access_name"],
>                                                "value" => $row["uid"]
>                                        );
>                                }
>                                return $aItems;
>                        ]]></php>
>                        </userobj>
>                        <items>
>                                <item caption="Autres" value="autres"/>
>                        </items>
>                        </data>
>                </renderlet:RADIOBUTTON>
> 
> 
> And I would like when a click on the "Autres"  RADIOBUTTON, a  checkbox 
> will
> be show. It's possible and how?
> 
> Then, I want to load some information for differents tables and show 
> then in
> a list. So i make a request on 2 tables and don't know how I can show the
> result in a listener form.
> 
> Finally, I use the RAW attribute to make my treatment in the PHP class. But
> how can I show a message to the user, like the required message ?
> 
> Regards
> 
> Aurélien Allienne


More information about the TYPO3-project-formidable mailing list