Problem with subform (hidden & visible)

Avatar

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

Avatar

Avatar

pguerett

Avatar

pguerett

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.

Avatar

21-01-2009

Event:



form1.Page1.DropDownList1::exit - (JavaScript, client)



No errors in javascript console.

Avatar

Avatar

Thomas_McConnac

Avatar

Thomas_McConnac

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

Avatar

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?????

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

23-01-2009

Send it to livecycle8@gmail.com and I will have a look.

Avatar

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.

Avatar

26-01-2009

Problem solved by Paul. I did not save the form as a dynamic form. Thanks Paul. At least my code worked..... 😉