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

Dynamic form updates out of synch

Runolfr
Registered: Oct 1 2008
Posts: 119
Answered

I'm designing a dynamic form that will show one of two different groups of checkboxes depending on the value in a drop-down list. I'm wondering if I'm using the wrong event to trigger the change, since it seems to be out of sync. In testing, when I change the value to "Company2", I don't see a change (the "Company1HardwareKits" group is the default). When I change back to "Company1", I see the "Company2" group. The actual switch statement seems to be correct, so I'm wondering if it's just a timing issue based on the event being used.

EquiptReqForm.MainForm.ColleagueInfo.Company::change - (JavaScript, client)

// change presence of Company1 or Company2 hardware kits based on value of Company drop-down
switch (this.rawValue) {
case "Company1":
MainForm.HardwareReqs.Company1HardwareKits.presence = "visible";
MainForm.HardwareReqs.Company2HardwareKits.presence = "hidden";
break;
case "Company2":
MainForm.HardwareReqs.Company1HardwareKits.presence = "hidden";
MainForm.HardwareReqs.Company2HardwareKits.presence = "visible";
break;
default:
MainForm.HardwareReqs.Company1HardwareKits.presence = "visible";
MainForm.HardwareReqs.Company2HardwareKits.presence = "hidden";
break;
} // company switch

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You're using the correct event, but the wrong value. On the "Change" event the field value is in the "xfa.event.change" property.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Runolfr
Registered: Oct 1 2008
Posts: 119
So it should be...

switch (xfa.event.change) {
case "Company1":
MainForm.HardwareReqs.Company1HardwareKits.presence = "visible";
MainForm.HardwareReqs.Company2HardwareKits.presence = "hidden";
break;
case "Company2":
MainForm.HardwareReqs.Company1HardwareKits.presence = "hidden";
MainForm.HardwareReqs.Company2HardwareKits.presence = "visible";
break;
default:
MainForm.HardwareReqs.Company1HardwareKits.presence = "visible";
MainForm.HardwareReqs.Company2HardwareKits.presence = "hidden";
break;
}

...?
Runolfr
Registered: Oct 1 2008
Posts: 119
Apparently so.