Custom HTML - Script to fill a field on value changed

Confluence User - 20 Aug, 2018

Hello,

I wrote the following script in a "Custom HTML" field to fill a field with part of the filename when a file is selected.

It worked perfectly in Version 8 of Joget, but since version 9, it doesn't.  Could someone help ?

Thank you in advance.

Daniel

<script>
//when File is selected (field "attachment" is changed)
$('#attachment').change(function(){
var f1 = FormUtil.getField("cb");
var t = FormUtil.getValue("attachment").split(/[\\\/]/).pop();
t = t.split(".")[0];
$(f1).val(t); //set value
});
</script>

forms

2


21 Aug, 2018
confluenceUser
confluenceUser

Hey Daniel,

Firstly, are you using Joget v5 or v6?

Secondly, is it possible to send us a sample app of this?

Tq.

26 Sep, 2018
confluenceUser
confluenceUser

Hi Justin,

We are using Joget Cloud edition (V6).

Regarding the sample app, I don't know what I could send you as I already included the complete script in my question.

In fact, the application is very simple : We have as form with 2 fields (1 "File Upload" field (ID = "attachment") and 1 "Text" field (ID = "cb")), and what I want to do is, when a file is selected for upload, get the name of the file from the "attachment" field and fill the Text field "cb" with a substring of it.

It worked perfectly in Joget Cloud V5

Thank you in advance for your help

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print