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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up windows and passing some values to it and from it???

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
0
0
I have a form that I have placed a link to open a popup. I got the popupwindow designed the way I want to but here is my problem:

I need to pass three values from the Customer's form to the popupWin and then the user will enter in some comments and press the submit comments button which will then pass the 3 pieces customer id stuff plus the comments to yet antoher page that will pass the info to ASPmail to send the email to an administrator.

Please let me know if you need to see any specific coding.

Thanks,

:)WB
 
Specific coding would be good but I would suggest a querystring as the answer. If you can post your code, I'll try and offer a solution.
 
I have performed something similar to this recently but I used Session Variables to pass my info.

On the first page Session("MyNewSessionVar")= Your value
On second page MyVar=Session("MyNewSeesionVar")

Hope this might help until a better solution comes through.

Bruce
 
Here is is code I have so far but can't seem to get it to work the way I want to. The most example I found on the web for option values and not for hidden input values.

function popUpdates(form)
{
var a = form.TempForm1.Field1.value;
var b = form.TempForm1.Field2.value;
window.open('bbUpdates.aspx?a=' + a + '&b=' + b, 'window1', 'status,noresize,scrollbars=0,width=500,height=300,left=100,top=100');
}

<form name=TempForm1 method=post action="bbUpdates.aspx" >
<input type = hidden name = creditorBenefitId value = "<%=Field1%>">
<input type = hidden name = companyId value = "<%=Field2%>">
To submit updates please click &nbsp;<a href="javascript:void(0);" onClick="popUpdates(document.forms[0]);">here</a></style>
</form>

I really can't change that much coding on the main form only I can add unless a defect is assigned to me to fix the existing code. So, I am limited to introducing new coding that might break the original one.

But anyway, hope the above helps.

Thanks,

:)WB
 
Ok I ended up doing this instead:

<a href="#" onclick = "window.open('bbUpdates.aspx?valueName=<%=valueName%>', 'window1', 'status,noresize,scrollbars=0,width=500,height=400,left=100,top=100')">Click Here</a>

Thanks.



:)WB
 
The solution I use in this situation is have the popup window's javascript retrieve the data or objects from the parent (opener) window. This to me is more attractive than passing the values in the querystring -- depending on the values passed, sometimes you'd rather the casual user not see those values (which they do in a querystring, assuming the target window has a location bar).
Code:
var x = parent.forms[0].SomeElementName.value;
I use this when I have a main window that has, for example, a dropdown list of values where I want the user to be able to add a value to that list without leaving the current data entry page. The "add to this list" link pops a new window, has a form to add a new value, then writes that new value back into the dropdown list on the parent page, then closes itself. The user is then back on the main data-entry page with the new dropdown option selected and ready to continue with entry. Many ways to do these things, though! Glad you got it working, and I'm thankful for the community.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top