Highlighted

Visible / Invisible code not working

Avatar

Guest

18-08-2008

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.

Replies

Highlighted

radzmar

MVP

19-08-2008

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 😉
Highlighted

Avatar

Guest

19-08-2008

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.
Highlighted

Avatar

Guest

20-08-2008

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";
Highlighted

Avatar

Guest

21-08-2008

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