Highlighted

Problem with subform (hidden & visible)

Avatar

Guest

20-01-2009

I am new to Javascript but feel embarrassed to ask since I have some programming background. Putting my pride behind me. I am trying to use a drop down list ("A" & "B") that will hide or make visible two subforms ("Subform1" and "Subform2"). This is pretty basic but I can not get it to work. Any suggestions?



if (this.rawValue == "A")

{

Subform1.presence = "visible";

Subform2.presence = "hidden";

}

else if (this.rawValue == "B")

{

Subform1.presence = "hidden";

Subform2.presence = "visible";

}

Replies

Highlighted

pguerett

21-01-2009

The script looks OK ...what event do you have the code running on?



Also if you are using Acrobat to test with you can hit Ctrl-J and see the javascript console ..which will report any errors in your script when it runs.
Highlighted

Thomas_McConnac

22-01-2009

Add the line



console.println ("" +this.rawValue);



Just before your presence changing code, just to check what value it is set to when you are running it. It might not have changed at the time you are running the code.



Tom
Highlighted

Avatar

Guest

23-01-2009

Thomas adding code did not fix problem. I would love to send pdf to someone to figure out what's going on. Any takers?????
Highlighted

Avatar

Guest

23-01-2009

As a general recommendation (since it's hard to debug in PDF), write code like this to trace the values before (or after) your code:



xfa.host.messageBox("RawValue: " + this.rawValue + "\nFormattedValue: " + this.formattedValue);

The messagebox will tell you if your values are what you expect them to be or not.
Highlighted