Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How do I use a radio button to enable a background image?

Avatar

Former Community Member

Good morning,

I have a two part question. I have a radio button on my form that I would like to behave as follows: if it is set to "Yes", a background image should appear on the form.

1. What is the best way to insert a background image into my form?

2. How do I enable the behavior such that if the Yes radio button is selected, the background image appears but if the No radio button is selected then it doesn't appear.

Thank you in advance for your help.

2 Replies

Avatar

Level 2

Maybe I'm over simplifying (not being an expert user myself), but don't you just create an image field on the master page and use the Action Builder to construct javascripts to make the field visible or hidden when the button field is checked and unchecked?

Having said that, I just tried it and although the actions are there it doesn't seem to function....

Avatar

Former Community Member

Hi,

Before designing the form you just select an image field and insert into your page. Then add an image which will be your background image.

Now, go to the object pallete,select Field Tab and go to the Presence section and select the presence as hidden. This means initially there will not be any images whenever user will open the form.

Now, in the click event of radio button just write the below code.

For Yes,

ImageField.presence = visible;

For No,

ImageField.presence = hidden;

Regards,

Manjeet