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

Drop down invisible

Avatar

Level 5

I wish when none select the drop down field, during print it will be invisible.

What condition now:

1. I have placed in layout ready event:

  this.rawValue = "select one";  // as default

2. Drop down events list set in objetc  are "A", "B", "C".

In this case how can I make invisible during print?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

In the prePrint event try:

if (this.rawValue == "select one") {

     this.presence = "invisible";

}

else {

     this.presence = "visible";

}

Then in the postPrint event have a line to make the field visible again:

this.presence = "visible";

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

In the prePrint event try:

if (this.rawValue == "select one") {

     this.presence = "invisible";

}

else {

     this.presence = "visible";

}

Then in the postPrint event have a line to make the field visible again:

this.presence = "visible";

Hope that helps,

Niall

Avatar

Level 5

Thanks for help.

one problem is that already if else cndition is placed in preprint event. So, how can I set up both condition (your given code and previous code) so that both will be executed.

Avatar

Level 10

Hi,

If the one condition suits both scripting requirements, then you can simply include both in the one if/else statement:

if (this.rawValue == "select one") {

     // do something with presence

     // do something with colour

}

else {

     // do something else with presence

     // do something else with colour

}

If the conditions are not compatible, then you can have one if/else statement following the other:

if (this.rawValue == "select one") {

     // do something with presence

}

else {

     // do something else with presence

}

if (NumericField.rawValue == 1) {

     // do something with colour

}

else {

     // do something else with colour

}

Hope that helps,

Niall