ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 25th, 2003, 02:26 PM
mtndew mtndew is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 mtndew User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question passing user entry from popup back to main form

Hi, I have a form in which a textbox is filled using a pop-up page. This pop-up page has a selection of values created dynamically from an access table. I need to know how to get the values selected from the pop-up back to the main form. Can anyone guide me in the right direction, please.

Many thanks,

mtndew

Reply With Quote
  #2  
Old March 27th, 2003, 01:36 AM
yassoor's Avatar
yassoor yassoor is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Canada - Egypt
Posts: 60 yassoor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
you could use the form Target paramemter

in the popup

<FORM name ="form_Name" Target = "main_PageName">

.....

</FORM>

but that will cause the main page to refresh.

To avoid refreshing

if the pop up window is opened using java script from the main page

use the .oDocument to have a reference back to the main document from the pop up

example

in the main page

you open the pop up using something like this

=============================
var theWindow = window.open( "", "", "whateverparamemter", "").document;

theWindow.open("text/html", "replace");
theWindow.oDocument = this;

theWindow.write("<HTML>the rest of the pop up page");
=============================

in side the pop up
to access the popup page you use document.X
to access the main page you use document.oDocument.X


I have done this before and works perfect. If you have any trouble with it let me know.


I hope this is of any help
__________________
I hope this is of any help to anyone.

Yassoor
http://www.WebsitesCreation.ca

Reply With Quote
  #3  
Old March 27th, 2003, 08:14 AM
mtndew mtndew is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 mtndew User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, I was able to figure it out and I'll share it with you;

First, on the form page I put in a function to open a new window(found this on the web and changed appropriately)

<SCRIPT LANGUAGE="JavaScript">

function newWindow(file,window) {
msgWindow=open(file,window,'resizable=no,Toolbar=no, menubar=no, status=yes, scrollbars=yes, height=400, width=600, left=50, Top=50');
if (msgWindow.opener == null) msgWindow.opener = self;
}
</script>

Then created an text input element so I would have someplace to put the chosen value(s).

<input name="TOE" type="text" value="Click Button to select" READONLY size="20" tabindex="5">

And a button in which to open the pop-up page;

<TD align="center" colspan="1" bgcolor="#D3D3D3"><input type="button" value="Type of Entry" onClick="newWindow('toe3.asp','window2')">
</TD>

Then, the pop-up page

First, a function to update the main form page (found on the web and changed accordingly)

<SCRIPT LANGUAGE="JavaScript">
<!--

function update() {
var output = '';

for (var i=0;i < document.forms[0].selectfield.options.length;i++) {
if (document.forms[0].selectfield.options[i].selected) {
output += document.forms[0].selectfield.options[i].value + ' ';
}
}

opener.document.forms[0].TOE.value = output;
window.close();
}


-->
</SCRIPT>

ADO Connection

<%
set rsTOE = Server.CreateObject("adodb.Recordset")
%>

Then, a table to hold a drop down select dynamically generated using vbscript and ASP;

<form onSubmit="return false">

<Table Border="0" Bordercolor="#000000" cellpadding="1" cellspacing="2" cols="4" width="55%">
<TR>

<TD align="left" colspan="1">
<%

sql="Select * From tblTOE Order By TOEID ASC"

rsTOE.Open sql, con
' Loop through recordset and display results
If Not rsTOE.EOF Then
rsTOE.MoveFirst
' the form below calls this file only this time with an id in the QueryString
%>


<SELECT NAME="selectfield" size=10 MULTIPLE tabindex="5">

<Option Value="" Selected></Option>
<%
' Continue until we get to the end of the recordset.
Do While Not rsTOE.EOF
' For each record we create a option tag and set it's value to the TOE ID
' The text we set to the TOE text
%>

<OPTION VALUE="<%= rsTOE.Fields("TOEID") %>"><%= rsTOE.Fields("TOE") %></OPTION>
<%
' Get next record
rsTOE.MoveNext
Loop
%>

</SELECT>
<%
End If
rsTOE.close
Set rsTOE = Nothing

%>
</TD>
<TD>
<%
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>For Multiple Selections</Font></Center>"
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>press CTRL key, click on each</Font></Center>"
Response.Write "<Center><Font Face='Lucida' Size='4' Color='#FFFFFF'>selection using left mouse button.</Font></Center>"
%>
</TD>
</TR>
</table>
</body>
</html>

Thanks for your suggestion, I will try it out. There is always something new to learn in this business.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > passing user entry from popup back to main form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway