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

Lisbox based on text field(s) data...

raemay
Registered: Jun 16 2009
Posts: 4
Answered

var a = this.getField("P_D1NAME").value;
var b = this.getField("C_D1NAME").value;
event.value = a +"\n"+b

My data shows up concatenated instead of being available as a choice from the list.

I have search through many archives but I can not seem to find an example anywhere.

Thank you very much for any assistance you may provide,
Rachel

My Product Information:
Acrobat Pro 8.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You have to use either the 'setItems()' method of the 'field' object. Try the examples in the Acrobat JavaScript API Reference.

George Kaiser

Freelancer
Registered: May 26 2009
Posts: 71
Hi,

So you want to populate a listbox with those values?

Lets say you have in your PDF form
TextFields named as P_D1NAME, C_D1NAME
ListBox named as LB_NAME
Button named as Button1 (as default)

So this is the code:

//
//Button1:Annot1:MouseUp:Action1
//
/*********** belongs to: AcroForm:Button1:Annot1:MouseUp:Action1 ***********/

var a = this.getField("P_D1NAME").value;
var b = this.getField("C_D1NAME").value;

this.getField("LB_NAME").setItems([[a,a],[b,b]]);

//
//Freelancer


Question to gkaiseril :
How to make code as separate list in the post,
there was somewhere explanation but can not
find it? It was something like [CODE] ... [CODE]

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Have you clicked on the "BBCode" link below the "Quick post" field?

I do not recommend editing through the 'Dcoument all JavaScripts' option.

George Kaiser

Freelancer
Registered: May 26 2009
Posts: 71
Thank you,
found it!

This is some code.
Freelancer =D

According to most IT HelpDesk people, the most common reason for user error (regardless of Operating System) is ID 10T.

raemay
Registered: Jun 16 2009
Posts: 4
Thank you all so much!

This is the final code I used:

var a = this.getField("P_D1NAME").value;
var b = this.getField("C_D1NAME").value;
c.setItems(a,b);

You guys are the best!

Sincerely,

Rachel