Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

List Box

DKinsley
Level 9
Level 9

Can a list box object flow? My form uses one as the user adds attachments the file names appear in the list box. When too many files have been added to be visible in the size of the list box, a scroll bar appears. Can I have the list box flow instead?

1 Accepted Solution
Ratnesh_Ranjan
Correct answer by
Level 3
Level 3

Hi DKinsley,

Place below code on click event of "Add Attach" button".

app.execMenuItem("AddFileAttachment");
var oObj = event.target;
var fileAttachments = oObj.dataObjects;
//app.alert(fileAttachments.length);

var d = event.target.dataObjects;
TextField1.rawValue="  ";
for (var i = 0; i <= fileAttachments.length; i++)

{

    TextField1.rawValue = TextField1.rawValue + "\n" + d[i].name;

}

Below is the screenshot of my form structure

attach.JPG.

Thanks

Ratnesh

View solution in original post

5 Replies
Ratnesh_Ranjan
Level 3
Level 3

Hi DKinsley,

Logically this is not possible because if you will make the list box flowed then it will no linger be a list box and will look like a text Field.

Please navigate to http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?topic=000323 page to know more about List Box.

listbox.JPG

You can use a textfield to display the attachment's name and can make it flowed.

Regards,

Ratnesh

DKinsley
Level 9
Level 9

Ratnesh,

Thank you for your reply and information. I am unable to get the same script to display the attachment's name in a Textfield named ListBox1. What do I need to change?

form1.#subform[0].Attachments.Button1::click - (JavaScript, client)

var d = new Date();

var myDoc = event.target;

var sFile = "myFile" + Math.floor(d/1000); 

myDoc.importDataObject({cName: sFile});

var myDataObject = myDoc.getDataObject(sFile);

var sFileName = myDataObject.path;

ListBox1.addItem(sFileName,sFile);

NumericField1.rawValue = NumericField1.rawValue + 1;

       

Ratnesh_Ranjan
Correct answer by
Level 3
Level 3

Hi DKinsley,

Place below code on click event of "Add Attach" button".

app.execMenuItem("AddFileAttachment");
var oObj = event.target;
var fileAttachments = oObj.dataObjects;
//app.alert(fileAttachments.length);

var d = event.target.dataObjects;
TextField1.rawValue="  ";
for (var i = 0; i <= fileAttachments.length; i++)

{

    TextField1.rawValue = TextField1.rawValue + "\n" + d[i].name;

}

Below is the screenshot of my form structure

attach.JPG.

Thanks

Ratnesh

View solution in original post