Get name of File Upload

Confluence User - 04 Aug, 2016

Hi, I'm a newbie

I have one File Upload and one text field. I uploaded one file to the form, not yet submit it, How can the text field get value of the name of file from File Upload's value?

Thank in advance

forms;user

8


05 Aug, 2016
confluenceUser
confluenceUser

Hi Thao Nguyen

The File Upload field would already store the filename. Why would you need to duplicate the value into another field in the same form?

05 Aug, 2016
confluenceUser
confluenceUser

Thank Matthew for your reply

Because the name of Uploaded file is a name of process that is exported from another application. I would need only 8 first characters of it then set text field to Datalist View so that it will be easier to track or monitor it.

Could you please show me how i could do it?

06 Aug, 2016
confluenceUser
confluenceUser

Hi Thao Nguyen

You can try using Javascript to copy the value of the "File Upload" field to a hidden field/another text field and using Javascript string processing to truncate the filename value, enclosing everything in a <SCRIPT></SCRIPT> command.

Do download the Service Help Desk app from Joget Marketplace where in the form Enterprise Issue:Update, you can view some working samples of javascripting (in CustomHTML field).

The Simple Leave app Apply Leave form also has simple javascripting to perform client side processing.

 

 

 

08 Aug, 2016
confluenceUser
confluenceUser

Dear Matthew

Noted with many thanks

09 Aug, 2016
confluenceUser
confluenceUser

I get the filename from the FileUpload. But I can not remove the file extension in this case.

Just to remove .pdf . Could somebody help?

 

09 Aug, 2016
confluenceUser
confluenceUser

Hi matthew, Pls help to check my code below whether correct or wrong: I could not get the filename from field ReferenceNumber. <script> 'var e = $('[name$=FileUpload1]').val() = e.slice(0, -4) ; var s = $('[name$=ReferenceNumber]').val(); var x = $('[name$=FileUpload1]').val(); var s = x.substr(0, x.lastIndexOf('.')); </script>

10 Aug, 2016
confluenceUser
confluenceUser
16 Aug, 2016
confluenceUser
confluenceUser

Hello Matthew, the reference number textfield value = the id of fileupload ========> but how to put the script to remove *pdf in the reference number? I tried to create a custom html but does not work.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print