1154
Views
4
Comments
Solved
How to invoke Action from Upload widget?
Question

Hi, I want to invoke action directly to save the file after user has chosen the file from upload widget and dont' want to have seperate button to trigger the action.  

2024-08-28 10-01-54
Kiran Shinde
Solution

Hi aung thiha,

The solution is just add button named 'Upload' that calls the action of upload file, set style extended property of button to "display:none;"   and set the onchange extended property of upload widget to "$('#"+Upload.Id+"').click();"

i have attached demo oml file hope this will help you.

Test2.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Thiha,

The Upload Widget is a browser widget (actually an "input" with type "file"), and it tells the browser to load a file from the local environment, and, like any kind of input, it just sits there until you press a button, the form is submitted and the contents of the file is sent.

You can perhaps detect the onchange event and use JavaScript to click a hidden button that triggers the Screen Action that saves the file. But note that each time the user selects a different file, that file is uploaded too, so you may need to do some checking there.

2024-08-28 10-01-54
Kiran Shinde
Solution

Hi aung thiha,

The solution is just add button named 'Upload' that calls the action of upload file, set style extended property of button to "display:none;"   and set the onchange extended property of upload widget to "$('#"+Upload.Id+"').click();"

i have attached demo oml file hope this will help you.

Test2.oml
UserImage.jpg
aung thiha

Thank you, both Kilian and Kiran. It works with your suggestions.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Thiha, glad we could be of help :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.