Question
· Sep 14, 2023

%OnSubmit is not invoked from client

Hi Guys,

I've an fileupload and button that executes   Upload() clientmethod to upload files in my database and everything works fine when I run the application in the server where it is located, but if I run it from a client machine the %OnSubmit class method doesn't get invoked when form.submit() get executed so how can I fix this?

I can always use <submit> button but the thing is that I need the current form to close after submitting the form but adding  &js<window.close()> st the end of %OnSubmit classmethod to close the window is not working 

<html>
<input type="file" size="80" name="FileStream" class="button" id="fileUpload" />
</html>
<image src="images/spacer.gif"  width="10" height="1" />
<imageclickbutton id="btnUpload" caption="Upload" width="90" height="30" onclick="zenPage.Upload();"/>
 

 

ClientClassMethod Upload() [ Language = javascript ]
{
zenSynchronousMode true;
if (document.getElementById("fileUpload").value != "") {
var p1 (document.getElementById("fileUpload").value).lastIndexOf("\\");
var fileName (document.getElementById("fileUpload").value).substring(eval(p1) 1, (document.getElementById("fileUpload").value).length);
zen("FileName").setProperty("value", fileName);
var form zenPage.getComponentById("mainForm");
if (form) {
    var ret=form.submit();
 

 

Thanks

Product version: Caché 2018.1
Discussion (1)1
Log in or sign up to continue