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

Populating a table w/drop down - all rows have same value for dropdown

cl5792
Registered: Jul 17 2008
Posts: 53
Answered

I have a folder level script (below):

function AddNewRow(sName, sAddress, sCompany, sSalesRep)
{
var NewRow = this.xfa.form.Root.Page2.Company.Detail.instanceManager.addInstance(0);
NewRow.Name.rawValue = sName;
NewRow.Address.rawValue = sAddress;
NewRow.SalesRep.rawValue = sSalesRep;
}

The function is called from a VB app to populate the form table (LiveCycle form) from a recordset. All works fine except that the drop down (SalesRep) has the same data for each row (which is the value for the last row added). They appear to be synched if the value is changed in the PDF. If I change one all of the rows change to that value. The drop down is populated on initialize event of the PDF and that is working fine as well.

Can anyone help with what I am missing to have the correct value showing in the drop down for each row? I was thinking that the problem was using the fully qualified reference, but I have not been able to figure out how to pass a reference and set a field variable to that object in the script.

Thank you for any assistance.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
So all of the "SalesRep" DropDowns change value at the same time? This would happen if the field binding was set to "Global". There could also be an issue with other code affecting the field. The path for the subform instance manager should not have any affect. It seems like it's doing what it should, i.e., creating a new instance.

If it's not the binding issue, then look through the form for code that might affect the value of the field, like the init event. Place "console.println()" statments in each relevant place. Then do some tests and see what shows on the console window. Try calling this function from the console so see if there is a differnce in action. Also try setting the value of "SalesRep" with code run from the console window.

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/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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

cl5792
Registered: Jul 17 2008
Posts: 53
Thank you Thom.

I feel sort of stupid, I did have the binding set to global. It works fine now.