[TYPO3-realty] Realty Objects - add new fields
Ada Borlovan
ada at borlovan.de
Fri Feb 5 14:15:21 CET 2010
Can you please give me a concret example?
When the first value in listbox is selected I want to hide all the fields
upon the class .example
So I guess that I need the selectedIndex from the listbox.
And then to make a switch. My problem is that I don't know how to get the
selecteditem.
This is what I have added in tx_realty_frontEndEditor.xml
<renderlet:LISTBOX name="immotyp"
label="LLL:EXT:realty_ext/locallang_db.xml:tx_realty_objects.immotyp">
<data>
<items>
<item>
<caption>LLL:EXT:realty_ext/locallang_db.xml:tx_realty_objects.immotyp.I.0</
caption>
<value>0</value>
</item>
<item>
<caption>LLL:EXT:realty_ext/locallang_db.xml:tx_realty_objects.immotyp.I.1</
caption>
<value>1</value>
</item>
<item>
<caption>LLL:EXT:realty_ext/locallang_db.xml:tx_realty_objects.immotyp.I.2</
caption>
<value>2</value>
</item>
</items>
</data>
<validators>
<validator:STANDARD>
<userobj>
<extension>this</extension>
<method>isIntegerInRange</method>
<params>
<data name="range"
value="0-2"/>
<data
name="multiple" value="0"/>
</params>
<message>
<userobj>
<extension>this</extension>
<method>getValueNotAllowedMessage</method>
<params>
<data name="fieldName" value="immotyp"/>
</params>
</userobj>
</message>
</userobj>
</validator:STANDARD>
</validators>
<onclick>updateHideAndShow();</onclick>
</renderlet:LISTBOX>
And in function updateShowandHide
switch ($("tx_realty_frontEndEditor_immotyp_item").selectedindex) {
case 0: $$(".gewerbeimmo").invoke("show");
$$(".wohnimmo").invoke("hide");
$$(".unbebaut").invoke("hide");
break;
case 1: $$(".gewerbeimmo").invoke("hide");
$$(".wohnimmo").invoke("show");
$$(".unbebaut").invoke("hide");
break;
case 2: $$(".gewerbeimmo").invoke("hide");
$$(".wohnimmo").invoke("hide");
$$(".unbebaut").invoke("show");
break;
}
What I make wrong? Give me please an advise how to do better.
-----Ursprüngliche Nachricht-----
Von: typo3-project-realty-bounces at lists.typo3.org
[mailto:typo3-project-realty-bounces at lists.typo3.org] Im Auftrag von Oliver
Klee
Gesendet: Freitag, 5. Februar 2010 13:09
An: typo3-project-realty at lists.typo3.org
Betreff: Re: [TYPO3-realty] Realty Objects - add new fields
Hi,
ada at borlovan.de schrieb:
> I founded the function updateHideAndShow(), I have understanded how it
> works.
> I have a listbox item and now I don't know how to hide ot show item
> depending on its selection.
>
> I want to do somwthing like this: (I not sure what function to use here)
> switch ($("tx_realty_frontEndEditor_immotyp_item").??selected??) {
> case 0: break;
> case 1: break;
>
> }
Indeed, you'll need to change/enhance the JavaScript function
updateHideAndShow.
This isn't particularly TYPO3-specific - it's just modifying the DOM
using Prototype's functions depending on the values of some form fields.
<http://www.prototypejs.org/learn>
<http://api.prototypejs.org/>
Oliver
--
Certified TYPO3 Integrator | TYPO3 Security Team Member
_______________________________________________
TYPO3-project-realty mailing list
TYPO3-project-realty at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-realty
More information about the TYPO3-project-realty
mailing list