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 invisible form when read only value is true

Avatar

Level 3

Hello,

I'm working on a form that has a table (example below) in which one of the cells contains a dropdown menu and once the user chooses a certain value from the list, the adjacent cell displays a number either 4, 10, or 12 (Calculated Read Only). All this is working fine. However, what I'd like to achieve is that I want to display an image in a third cell based on my calculated value (4, 10, 12) same image for 4 and 12. I was able to achieve this by adding the following code (see below) to the Drpdown field under "change* javaScript”. However, I want to be able to make this happen when the read only cell changes as opposed to the Drp down values which are too many....

var temp = xfa.event.newText

if (temp == " ") {

LabelSample.presence = "invisible"; }

else if (temp == "Item One") {

LabelSample.presence = "visible"; }

else if (temp == "Item Two") {

LabelSample.presence = "visible";}

else

{LabelSample.presence = "invisible";}

Header 1Header 2Header 3
DropDown Menu ItemsRead Only Value (4, 10, or 12)Display Image wrapped in subform Called "LabelSample"

Thank you for your help!!!!!

3 Replies

Avatar

Level 10

Hi,

I would stick with the dropdown, but maybe put the script in the exit event.

Then just set the label presence to invisible and one if statement can check for both .rawValues:

LabelSample.presence = "invisible";

if (this.rawValue == "Item One" || this.rawValue == "Item Two")

{

     LabelSample.presence = "visible";

}

The || stands for 'or' in the if statement.

Hope that helps,

Niall

PS the above is based on using the exit event of the dropdown.

Avatar

Level 3

Thank you, but I was wondering if there is any way I could use the calculated field since the values are always either 4, 10 or 12, as oppose to the dropdown values that are way too many and sometimes new values are added.....

Thank you much!!!!!

Avatar

Level 10

Hi,

You could add the script beneath the calculate script in the calculate event of the readOnly field.

//calculate script first then if statement for label
LabelSample.presence = "invisible";

if (this.rawValue == "4" || this.rawValue == "12")
{
     LabelSample.presence = "visible";
}

Hope that helps,

Niall