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.

Javascript Help - Customising buttons to display varied data

Avatar

Former Community Member
Hi there,



I'm looking for some Javascripting help since I'm new to this form of scripting. In the report template I'm creating, I need to have a series of radio buttons with each being able to display a different amount of data when selected. So for example, if you choose option a and hit the select button: one layout for the document is shown, option b: another different layout would display, etc.



Here's a link to an existing pdf which demonstrates what I'm looking for in the second half of the page. The pdf is locked so I can't look at the existing coding or anything that they've used. Any help would be greatly appreciated~ Thanks.



http://www.lands.nsw.gov.au/_media/lands/pdf/rp_dealings_interactive/01T_v3-2.pdf
1 Reply

Avatar

Former Community Member
Nariko,

Place your "different amounts of data" in their own subforms. Have each subform default as hidden so that they won't show. Next in the change event for the radio button group place the following javascript (this assumes your radio button group has it's values bound as 1, 2, & 3):



if(this.rawValue == 1)

{

subForm1.presence = "visible";

subForm2.presence = "hidden";

subForm3.presence = "hidden";

}

else if(this.rawValue == 2)

{

subForm2.presence = "visible";

subForm1.presence = "hidden";

subForm3.presence = "hidden";

}

else if(this.rawValue == 3)

{

subForm3.presence = "visible";

subForm1.presence = "hidden";

subForm2.presence = "hidden";

}



This will display and hide the objects in the various sub forms based on which radio button is selected.