These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Using switch (xfa.event.newText) in a Table

Profy
Registered: Jul 15 2010
Posts: 19
Answered

Here is the script I have:
 
MonthlyCableHPSD.#subform[2].Materials_Used::change - (JavaScript, client)

switch (xfa.event.newText)
{

case "Cable":
Cable.presence = "visible";
Cable_BOM_Code.presence = "visible";
Jacks.presence = "invisible";
Jacks_BOM_Code.presence = "invisible";
Face_Plates_and_Boxes.presence = "invisible";
FacePlate_BOM_Code.presence = "invisible";
Misc.presence = "invisible";
Misc_BOM_Code.presence = "invisible"; break;

default:
break;
}
 
I have a drop down list name "Materials_Used" in there an option for "Cable". If you select Cable a second drop down becomes visible, and when you select a topic out there it will auto populate a textfield. Everything works just fine. But when I put it into a table nothing works no more. I tried adding the the script as below:
 
MonthlyCableHPSD.#subform[2].Materials_Used_Table.Row1.Materials_Used::change
 
switch (xfa.event.newText)
{
Materials_Used_Table.Row1.Cable.presence = "visible";
 
default:
break;
}
 
But still nothing works.
 
Does someone know the fix for this?

My Product Information:
LiveCycle Designer, Windows
Niall
Expert
Registered: Apr 26 2006
Posts: 62
Hi,

It should work without having to specify the row in the reference. If Materials_Used and Cable objects are in the same row, then it should work as per the original script.

In the second script block you don't have a case"Cable":, which may be throwing it.

The easiest way to make sure that you have a correct object reference in your script is to let LC Designer input the reference into the script for you. First select the object that you are putting script into. Click into the script editor, then hover the mouse over the object you want to reference. Press and hold Control. The mouse will change to a 'V', now click the object and LC Designer will insert the object reference.

Where objects are in the same row, the minimum reference would be the object's name.

Lastly, make sure that the form is saved as a Dynamic XML Form in the save as dialog.



Hope this helps,

Niall
Assure Dynamics

Profy
Registered: Jul 15 2010
Posts: 19
Accepted Answer
Hello Niall,

Thank You for the quick response, the control feature is nice I can use that in the future. But I am still a having troubles. The second line was more for an example then the actual script, with the case "Cable": missing.

If you have any other ideas that might help, please let me know.
Profy
Registered: Jul 15 2010
Posts: 19
I figured it out, the Table was hiding the dropdown field when I put it in the table. I never seen this before. It was like the table was in front on the dropdown field, but when I looked at sending the table to back it was already back. So I brought in a new table and it works fine. Thanks for your help thou.