How to invoke Action from Upload widget?

How to invoke Action from Upload widget?

  

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.  

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.

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.

Solution

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

Hi Thiha, glad we could be of help :)