I posted this last week, but it seemed to disappear. If it was removed, please let me know if there is another place I should be asking about this.
I'm a complete novice to JavaScript and have complied what I can from what I've found on this forum so far. I almost have my script working, but I'm missing something. Using Acrobat X Pro.
Basically, the form is meant to pick a department from one drop down, a position from another, and that position will populate the two text fields with required equipment and accounts (form for tracking employee equipment and accounts).
To achieve this, I created one drop down with all the departments, and have separate dropdowns for each department to select the positions. I originally tried to have the department dropdown populate a single dropdown with that departments specific positions. I got that to work, but couldn't figure out how to then make the position one populate the text boxes.
So what I have now is a drop down for each department which contains the positions and just hide / show them based on the department selected. I then used a script to populate the text boxes based on the position selection, which is working.
My problem is I can't get multiple departments to work. The script will allow a single dropdown to populate the text fields, and the others do nothing.
Here is the script I'm using with only 2 departments (haven't added more since I can't get the two working). Right now, this scrip will populate the Admin and InformationSystems dropdowns with the correct position. The admin one will populate the text fields EquipText and AccountText as intended, but the InfoSys one will not populate the text boxes at all.
I really really appreciate any help anyone can give!
//*****************************************************************************************
//ADMIN
//First make the values for Admin Department.
myAdminValues = ["", "CEO", "CFO", "Assistant"];
//Then populate the values to Admin Department.
this.getField("Admin").setItems(myAdminValues);
// Then you define what has to be shown in textboxes when value is selected
var AdminData = { CEO:{ equip: "Blackberry" ,
account: "Raiser's Edge, Crossnet, ProxCard" },
CFO:{ equip: "Laptop, Blackberry, Keys, ProxCard, ADP",
account: "Raiser's Edge, ISIS, Crossnet" } ,
Assistant :{ equip: "Laptop, Blackberry",
account: "Raiser's Edge, Crossnet, CEO Email" }
};
//Finally set the values of the textboxes
function SetFieldValues(cDeptName2)
{
this.getField("EquipText").value = AdminData[cDeptName2].equip;
this.getField("AccountText").value = AdminData[cDeptName2].account;
}
//*****************************************************************************************
//INFORMATION SYSTEMS
//First make the values for Infosys Department.
myInfoSysValues = ["", "Manager", "Coordinator", "Associate"];
//Then populate the values to Infosys Department.
this.getField("InformationSystems").setItems(myInfoSysValues);
// Then define what has to be shown in the textboxes when value is selected
var InfoSysData = { Manager:{ equip: "Laptop, Blackberry" ,
account: "Raiser's Edge, ISIS, Extranet, Crossnet" },
Coordinator:{ equip: "Laptop, Blackberry, Keys",
account: "Raiser's Edge, ISIS, Extranet, Crossnet" } ,
Associate :{ equip: "Laptop",
account: "Raiser's Edge, ISIS, Extranet, Crossnet" }
};
//set the values of the textboxes
function SetFieldValues(cDeptName1)
{
this.getField("EquipText").value = InfoSysData[cDeptName1].equip;
this.getField("AccountText").value = InfoSysData[cDeptName1].account;
}
Are there any errors in the JS console?
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com