Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect from within a popup window ?

Status
Not open for further replies.

gregas

Programmer
May 21, 2001
22
US
I have a form in a popup window that creates an object (namely, a "Prospect"). The form creates the object fine, but when I click "Save" I want to redirect the user to another form -- within the popup window -- while passing some of the newly created object parameters (such as ProspectID).

Last hitch -- it needs to work in IE and Netscape.

Any thoughts?

All help appreciated,
asg

 
<script language=javascript>
function redirect(){
var url = whatever.com;
url = url + '?varName1=' + value1;
url = url + '&varName2=' + value2;
url = url + '&varName3=' + value3;
location = url;
}
</script>

And so on, until you have tacked all of your variables onto the querystring, and the location statement will move the location of the window for ya.

You would call it like this:

<input type=button value=Save onClick=&quot;redirect();&quot;>

And you could send it some variables in the function call if you needed to... but most likely they will be stored in either visible or hidden form elements (I would think), so it would probably be unnecessary to do so.

If security is an issue, then you can always set up an entirely hidden form, that would have a method=post and then in the redirect function, you would assign values to the various hidden form elements, and then submit the form programmatically like:

document.formName.submit();

which, if the action of the form was pointing to the proper place, all is good.

The advantage, of course, is not having all the variables visible to the user (therefore making the page bookmarkable), but rather passing them transparently in the form object.

hope that helped :)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top