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.

Visible / Invisible code not working

Avatar

Former Community Member
This code used to wokr well under LiveCycle 8.0 but doesn't work with ES. Can you help me figure out why?



if (this.rawValue == "SNF" || "Custodial"){

DischargedToForm.presence = "visible";

}else{

DischargedToForm.presence = "invisible";

}

DichargedToForm is a subform containing a text box for additional information.
5 Replies

Avatar

Former Community Member
Are you sure your form is saved as dynamic or you are previewing it as dynamic?

Avatar

Level 10
Did you tried to mod your script a litle bit, like this?



if (this.rawValue=="SNF"),

if (this.rawValue=="Custodial");

_DischargedToForm.presence = "visible";

else

_DischargedToForm.presence = "hidden";



Don't forget to use JavaScript not FormCalc for scripting language ;-)

Avatar

Former Community Member
Hi,

Your script doesn't work, Marcus.

Try this one instead:



if (this.rawValue=="SNF" || this.rawValue=="Custodial")

{

_DischargedToForm.presence = "visible"

}

else

{

_DischargedToForm.presence = "invisible"

}



As mentioned before, you must remember to select javascript, and save as dynamic form.

Avatar

Former Community Member
Thanks everyone for their input. I finally have it working and here is the code that works.



What this code does is when a change event is triggered in a drop down (this)that meets the either or condition it makes a subform (DischargedToForm)containing a text box visible for additional information input.



if (this.rawValue=="SNF" || "Custodial")

DischargedToForm.presence = "visible";

else

DischargedToForm.presence = "hidden";

Avatar

Former Community Member
Hi Parakash,

The syntax of OR clause in Javascript is as:



if (this.rawValue=="SNF" || this.rawValue=="Custodial")

DischargedToForm.presence = "visible";

else

DischargedToForm.presence = "hidden";



Your script work for all the values of the items to the if item, making it visible. Try your script first in your designer first. It does not work for me with Acrobat 8.1.2.

"_DischargeToForm" means "DischargeToForm.instanceManager".

"invisible" makes form invisible but have place on the form.

"hidden" makes form invisible and remove from layout also.

Asiye