Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing javascript to perform two actions on uploading a file. File and file details are not passed onto the javascript function
    primarykey
    data
    text
    <p>I am using this code to upload a file. I have to perform two submit actions. So I call a javascript function onclick(). However, neither the file nor the file details entered using the form are transferred to the javascript function. What am I missing here?</p> <pre class="lang-html prettyprint-override"><code>&lt;jsp:include page="template-top.jsp" /&gt; &lt;script type="text/javascript"&gt; function onSubmit(){ document.forms["frm"].action="http://192.168.1.53/api.php/submit.xml"; document.forms["frm"].target="_blank"; document.forms["frm"].submit(); document.forms["frm"].action="directuploadsubmit.do"; document.forms["frm"].target="_blank"; document.forms["frm"].submit(); } &lt;/script&gt; &lt;style type="text/css"&gt; td.boldtext{ font-weight: bold; font-family:Helvetica,sans-serif; font-size:16pt; color:black; width:200; } &lt;/style&gt; &lt;%@ page import="databeans.Submit" %&gt; &lt;%@ page import="databeans.User" %&gt; &lt;%@ page import="databeans.Sandboxes" %&gt; &lt;% User user = (User) session.getAttribute("user"); %&gt; &lt;div style="visibility:hidden"&gt; &lt;iframe NAME = "iframe1" WIDTH="40" HEIGHT="40"&gt;&lt;/iframe&gt; &lt;/div&gt; &lt;form id="frm" name="frm" method="POST" enctype="multipart/form-data"&gt; &lt;table&gt; &lt;tr&gt; &lt;td class="boldtext"&gt; Direct Submission &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;table&gt; &lt;tr&gt; &lt;td colspan="2"&gt; &lt;font color="red"&gt;Complete notes as Case#:Notes (Example: &lt;font color="blue"&gt;"Case12345:test sample"&lt;/font&gt;) &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50&gt; &lt;font color="black" face="Helvetica,sans-serif"&gt;File:* &lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="file" name="file" value="${filename}" size="100"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="hidden" name="email" readonly="readonly" value="&lt;%=user.getUserName() %&gt;" size="100"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50&gt; &lt;font color="black" face="Helvetica,sans-serif"&gt;Notes: &lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="notes" value="" size="100"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50&gt; &lt;font color="black" face="Helvetica,sans-serif"&gt;Sandbox: &lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;select name="sandboxes[]"&gt; &lt;option value="00-0C-29-CF-B8-A6"&gt;VMSB1 - Win7&lt;/option&gt; &lt;option value="00-0C-29-0A-AB-9A"&gt;VMSB2 - WinXP&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50 colspan="2" align="left"&gt;&lt;font face="Helvetica,sans-serif" color="FF0000"&gt;All * marked fields are mandatory &lt;/font&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width=50 colspan="2" align="center"&gt; &lt;!-- &lt;input type="submit" name="submit" value="Submit" onclick= "this.form.target='_blank'; return true;"&gt; --&gt; &lt;input type="submit" name="button" value="Submit" onClick="onSubmit()"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;jsp:include page="template-bottom.jsp" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload