PDA

View Full Version : submitting to a pop-up


ellcon
07-16-2002, 03:44 PM
I want a button to POST data to a pop-up page without changing the original page. How would I do this?
Thanks,
Ian

tamienne
07-16-2002, 03:52 PM
All you need to do is change the target of the form to the name of the popup.

<FORM TARGET="popupName">

ellcon
07-16-2002, 03:55 PM
well the problem is is that this is a second button in the same form that needs to submit to a different page that needs to popup. Any ideas?

tamienne
07-16-2002, 04:00 PM
have the second button call a function that switches the target..

<INPUT TYPE="BUTTON" onClick="showInPopup()">

function showInPopup() {
document.formName.target="popupName";
document.formName.submit();
}

ellcon
07-16-2002, 04:07 PM
what would go in "popupname" is that the type of pop-up? or is that the link?

tamienne
07-16-2002, 04:16 PM
how are you opening the popup?

If you go something like
window.open("popupURL","popupName","popupProperties")
you have more control over the popup.

If you just put in a string like "myPopUp" in the target like i had before it will automatically take over the popup with that name or, if not already opened, create one.

ellcon
07-16-2002, 06:36 PM
I need to know how to reset the form action after a popup window has been opened. The popup window comes up after the form action has been changed through javascript. But then I need the form action to change back to it's original. Any ideas?
Thanks,
Ian

tamienne
07-16-2002, 06:51 PM
you can change it back by

target="_self".

ellcon
07-16-2002, 07:01 PM
Thanks so much for all your help. I can't get that working however. Here is some of my code:
else {
if(which == 1) {
document.mainform.action="formparse.cgi";
}
if(which == 2) {
document.mainform.target="_blank";
document.mainform.action="formparse.cgi";
}
else {
}
}

so one button on the form just goes to formparse while another button goes to formparse in a pop up window. However the main form then is stuck with formparse as it's new action and blank as it's new target. If I put document.mainform.action="defaultaction.cgi"; at the end of this blurb of code, all my submit buttons use the default action. How can I get it to reset the action after the pop up window comes up? Thanks in Advance.

tamienne
07-16-2002, 07:21 PM
Originally posted by ellcon

else {
if(which == 1) {
document.mainform.target="_self"; document.mainform.action="formparse.cgi";
}
if(which == 2) {
document.mainform.target="_blank"; document.mainform.action="formparse.cgi";
}
else {
document.mainform.target="_self";
}
}