Hello,
We are experiencing an issue with one of our applications where a Widget Click isn't triggering in certain circumstances. I'm attaching a sample application I built that reproduces the issue.
The application allows a user to upload a file, and should also allow them to replace that file with a different one. The initial upload is working, but the replacement of the file isn't.
We are using the Upload widget for the file upload. The Upload button uses the Submit method to trigger the "GetUploadData" screen action, which gets the data from the Upload widget. At the end of this action, we use the Widget_Click server action to trigger the "Hidden_Spinner" button. This in turn uses the Ajax Submit method to trigger the "Initiate_Load" screen action. This action does an Ajax refresh, followed by a Widget_Click to trigger the "Hidden Upload" button. This button uses the Submit method to trigger the "Upload File" screen action, which performs the file upload.
When there is an existing file, the Upload widget is initially hidden and the user sees a "checklist" item. Clicking on that item refreshes the page and again displays the Upload widget to allow the user to replace the file. In this scenario, when the user clicks the Upload button, the Widget_Click in the "GetUploadData" screen action doesn't trigger the "Hidden_Spinner" button, and the process stops there before ever reaching "Initiate_Load" or "Upload File".
I searched the OutSystems forums and based on threads I found, tried replacing the Widget_Click with JavaScript actions, but none of them worked. (I left them in the solution, but disabled them.)
I appreciate any feedback.
Thank you,
Mary Tipper
This issue has been resolved.
This is what I did to get this to work.
Hi @Mary Tipper,
I'll analyse the issue you're having, but in the meantime, please try the following js:
"document.getElementById('"+ btnHiddenUploadFile.Id +"').click()"
btnHiddenUploadFile.Id - is the Id of the button/link
Hope this helps!
Thanks,
Thank you Deepika.
I have tried using the JS you provided, but it didn't work.
It should actually be in the app I provided, but disabled, along with several different JS statements I tried.
Mary