This seemed so trivial when I started off with it! My objective is this:
Here's how I'm doing this:
<form action="/system/wpacert" method="post" enctype="multipart/form-data" onsubmit="return closeSelf()" name="certform"> <div>Certificate 1: <input type="file" name="cert1"/></div> <div>Certificate 2: <input type="file" name="cert2"/></div> <div>Certificate 3: <input type="file" name="cert3"/></div> <div><input type="submit" value="Upload"/></div> </form>
and the Javascript looks like this:
<script type="text/javascript"> function closeSelf(){ self.close(); return true; } </script>
This seems to work fine on IE8 and Chrome; but Firefox refuses to submit the form; it just closes the popup. What might I be doing wrong?
Had forgotten to post the code the opens the popup. Here it is:
<div><input type="submit" value="Upload Certificates" onclick="popupUploadForm()"/>
And the corresponding javascript:
function popupUploadForm(){ var newWindow = window.open('/cert.html', 'name', 'height=500,width=600'); }
From the form editor, navigate to Share → Embed. Scroll down to the "Popup" section. Copy the embed code from that section and paste it on the desired page in your website. For website builders, you would put this in a code block or similar.
I have executed the code in my machine its working for IE and FF also.
function closeSelf(){ // do something if(condition satisfied){ alert("conditions satisfied, submiting the form."); document.forms['certform'].submit(); window.close(); }else{ alert("conditions not satisfied, returning to form"); } } <form action="/system/wpacert" method="post" enctype="multipart/form-data" name="certform"> <div>Certificate 1: <input type="file" name="cert1"/></div> <div>Certificate 2: <input type="file" name="cert2"/></div> <div>Certificate 3: <input type="file" name="cert3"/></div> // change the submit button to normal button <div><input type="button" value="Upload" onclick="closeSelf();"/></div> </form>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With