Expand my Community achievements bar.

SOLVED

List Box

Avatar

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

Avatar

Correct answer by
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

Avatar

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

Avatar

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;

       

Avatar

Level 9

Anyone know the answer to this?

Avatar

Correct answer by
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