Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Displaying different subforms based on a dropdown list

Avatar

Former Community Member

Hi,

Does anyone have a basic script to display different subforms depending upon the value in a dropdown list?  I have tried the following code in the change event of the dropdownbox, but it has no effect.  I am developing a form in Lifecycle Designer 8.2.

 

form1.test1.DropDownList1::change - (JavaScript, client)

if (this.rawValue=="1")

subform1.presence="visible"

else

if (this.rawValue=="2")

subform2.presence="visible"

else

subform1.presence="invisible"

Please can anyone advise me?

Thanks

subform2.presence="invisible"

5 Replies

Avatar

Former Community Member

Hi wyn,

This tutorial sounds like it will help:
https://asib-na4.adobeconnect.com/_a828398527/p37533907/?launcher=false&fcsContent=true&pbMode=norma...

Fast forward to 25:00

Sounds like you want to use his Idea of adding Subforms using javascript

Hope this helps,

Paul

Avatar

Former Community Member

Hi Paul,

Unfortunately it wasn't quite what I was after.

I am quite happy to use form calc or another method to achieve the goal and not java if this is easier, as I am not a java expert.

Baically I want to display different fields in a small area of my form depending on the value chosen in a dropdown list and thought having the fields contained in a number of different small sub forms would be best way forward.

I would appreciate any help you could give me if there is an alternative way to achieve my goal.

Thanks

Wyn

Avatar

Former Community Member

There is a part in that video where the presenter speaks about doing what I think you're asking with radio buttons (instead of a dropdown list) where if (for example) you choose a radio button "cash" it will not display a blank field, but if you choose "credit" the blank area will populate with a creditcard form. If I understand your question correctly this idea should be able to be applied to both. You may have to use javascript as this video shows to fix your problem. I'm unsure though as I dont use form calc.

Paul

Avatar

Former Community Member

Hi Paul,

Thank you.  I found the correct section in the video and managed to get it to work.  Do you know if it is possible to control whether fields are visible if they are in subform when the combo box or drop downlist is in the main form?

Rgds

Wyn