Visible / Invisible code not working

Avatar

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

19-08-2008

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

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
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 😉

Avatar

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.

Avatar

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

Avatar

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