Click to See Complete Forum and Search --> : transferring submit true-flag between windows


ronnie99
03-11-2003, 07:36 PM
hi,

i'm using a form to upload files & text, and have a pop-up window coming up on certain cases, with a "CLICK TO CONTINUE UPLOAD" button - to start the original form submission.

the problem - how do i make sure the original window knows that the pop-up CONTINUE button has been pressed, and not the CANCEL UPLOAD, for example??


r. :)

Jona
03-11-2003, 10:37 PM
You mean you want to know which button was clicked and pass it as a variable to a new window?

AdamBrill
03-11-2003, 10:59 PM
Try the attached code. Open the index.htm and then click the open window link. Then click one of the buttons and the original page will tell you which one you pushed. I think that is what you want. :D

Jona
03-11-2003, 11:21 PM
Here's a little code I just whipped up. I hope it's what you're looking for, or at least close


<html><head>
<script>
function add(){
win = window.open('');
win.document.write('You clicked the cancel button. The process has been canceled.');
location=window.history.go(-1);
}
function add2(){
win = window.open('')
win.document.write('ok, you clicked the upload button. continuing uploading process...');
document.frm.submit();
}
function exit(){win.close()}
</script></head><body onunload="exit()">
<form name='frm' action="blah.cgi">
<input type=button onclick="return add()" value="cancel">
<input type=button onclick="return add2()" value="upload">
</form></body></html>

ronnie99
03-12-2003, 05:16 PM
hi,

i think that the "document.frm.submit()" should work - i'll try it and get back to you if it won't.
the other one (popup.zip) gives me a "window.opener is null or not an object" error for some reason, but otherwise, it might also do the trick.

thankyou both!

p.s. - the problem i have is a little more complicated, since i'm also running another 2 scripts on submit, which together are called via the onsubmit handler: "onsubmit=return submitonce(this);".
this is what's giving me a headache since up until now, the popup window script would always return true or false regardless of what happens (since it's on a different window). hope your help will do the trick!
10x :D

ronnie99
03-12-2003, 10:13 PM
well, managed to do this using the document.frm.submit() function but it's a little messy now:
the submit button now doesn't submit at all but only open a new window, and the button on the new window does the submission.

what i'd really like is to have my "onsubmit=return submitonce(this)" function do it all, it looks something like this:

function submitonce(theform){
if (!formCheck(theform)) return false;
if (!check_similar_titles()) return false;
do some stuff and eventually....
return true;
}

now the "check_similar_titles()" function opens up a new window, shows some list of titles, and all i need is to make it true or false depending on which button was pressed on that pop-up window. NOT TOO COMPLCATED, EH??

so how do i do it??????????????? :confused: :confused: :confused:

Jona
03-12-2003, 10:32 PM
May we see the whole page?