Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to display a hidden Image ?

Avatar

Level 9

Hello All ,

I have a form where, there are several images which are hidden and excluded from the layout. There are several checkboxes are present.If some conditions are met (a particular checkbox is checked) then it should display the image. I have a conception that Images are not associated with scripts.

Is it wrong ? any help regarding this would be appreciated.

Thanks.

Bibhu.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Bibhu,

No, it is fully available in FormCalc, you just need to change the syntax.

In FormCalc, it would look like:

if ($ == "1") then
     image1.presence = "visible"
else
     image1.presence = "hidden"
endif

Hope that helps,

Niall

View solution in original post

4 Replies

Avatar

Level 10

Hi Bibhu,

The presence property of an image object and an imageField object can be set quite easily.

For example the click event of the checkbox could have the following JavaScript:

if (this.rawValue == "1")

{

     image1.presence = "visible";

}

else

{

     image1.presence = "hidden";

}

If there are other criteria, you would just extend the test conditions.

Hope that helps,

Niall

Avatar

Level 9

Hello Niall,

Thanks for the help. But I can do this in JavaScript, When I use FormCalc then it throws error. I am just confused. Is it only applicable in JavaScript and not in FormCalc ?

Thanks.

Bibhu.

Avatar

Correct answer by
Level 10

Hi Bibhu,

No, it is fully available in FormCalc, you just need to change the syntax.

In FormCalc, it would look like:

if ($ == "1") then
     image1.presence = "visible"
else
     image1.presence = "hidden"
endif

Hope that helps,

Niall

Avatar

Level 9

Hello Niall,

Thanks. It worked. But what I feel JavaScript is user to implement than FormCalc. Sometimes I think , Why I have not blessed with the wit of Niall .

Thanks.

Bibhu.