Expand my Community achievements bar.

SOLVED

Get attach file name

Avatar

Former Community Member

Hello all,

I want to get the name of the attached file into the text field.

I have referred several documents but they are not solving my issue. I don't want to use list box, I want the name in text field.

Thanks in advance.

Gopi

1 Accepted Solution

Avatar

Correct answer by
Level 10

Ok,

you should have tell me before.

Add this script to the Add button of your repeating table row.

It will look for the name of the attchment with the same index number as the current row.

var o = event.target.dataObjects;

Texfield.rawValue = "";

if (o !== null) {

          Texfield.rawValue = o[this.parent.index].name;

}

View solution in original post

3 Replies

Avatar

Level 10

Hi,

you can use JavaScript to get the names of attached files:

var o = event.target.dataObjects;

var n = "";

Textfield.rawValue = "";

if (o !== null) {

          for (var i = 0; i < o.length; i += 1) {

                    n += o[i].name + "\n";

          }

}

Textfield.rawValue = n;

Avatar

Former Community Member

Hi radzmar,

Your code was helpful.

But I want this functionality for for multiple lines which will get added dynamically. When I'm adding the row dynamically it is appending the data into the same textfield instead of the next. It will be clear from below image, Here I have added second row dynamically by clicking on "+" button and attached the file but it is showing it in the text field of 1st row.

ScreenHunter_01 Dec. 11 16.18.gif

Thanks in advance and waiting for your response.

Avatar

Correct answer by
Level 10

Ok,

you should have tell me before.

Add this script to the Add button of your repeating table row.

It will look for the name of the attchment with the same index number as the current row.

var o = event.target.dataObjects;

Texfield.rawValue = "";

if (o !== null) {

          Texfield.rawValue = o[this.parent.index].name;

}