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

Incorporate a popup window into this code 1

Status
Not open for further replies.

kiwieur

Technical User
Apr 25, 2006
200
GB
Hi I have this code which is working fine
Code:
<form action="ExSampleAddress.asp" name="frmAdd" target="_blank" class="input" id="frmAdd">
  <% If Not rsAddresses.EOF Or Not rsAddresses.BOF Then %>
  <table width="40%" border="0" align="center">
    <tr class="TextCentrePlain10px">
      <td><select name="lstMain" class="TextCentrePlain10px" id="lstMain" onChange="javascript:document.frmAdd.submit(this.form)">
              <option value="Select Customer">Select Customer</option>
		<%
While (NOT rsAddresses.EOF)
%>
        <option value="<%=(rsAddresses.Fields.Item("CustomerNo").Value)%>"><%=rsAddresses("CustomerNo") & "   " & left(rsAddresses("Address1"),20) & "   " & rsAddresses("PostCode")%></option>
        <%
  rsAddresses.MoveNext()
Wend
If (rsAddresses.CursorType > 0) Then
  rsAddresses.MoveFirst
Else
  rsAddresses.Requery
End If
%>
      </select></td>
      
    </tr>
  </table>
  <% End If ' end Not rsAddresses.EOF Or NOT rsAddresses.BOF %>
</form>

however I would like it to open in a popup window if possible. I do use the following on another page but i am unsure about how to incorporate it in this instance
Code:
<a href='JavaScript:openPopWin("[URL unfurl="true"]http://MyNet/Enquiries/ExDeladdress.asp?<%=[/URL] Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "companynumber=" & rsDetails.Fields.Item("companynumber").Value %>", 700, 600,"scrollbars", 400, 250)' class="TextLeft12px">Search</a>
Would anyone be able to point me in the right direction please

Regards

Paul
 
feherke,
thank you for your prompt response and information. I will look at what you say and see if I can work it out

Regards

Paul

 
what is:

rsDetails.Fields.Item("companynumber").Value

Is that the value of the option selected from the drop down list?



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Or, sorry - what is the exact url of the page you want to open, are you simply passing the value of the selection from the drop down as a "GET"?


--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Hi vicvirk,

the url is as follows

Code:
[URL unfurl="true"]http://MyNet/Enquiries/ExSampleaddress.asp[/URL]

and the value I am passing is

Code:
rsAddresses("CustomerNo")

which is a POST

Regards

Paul
 
Can you change it to a "GET"? If so, try this

The script at the top opens up a pop up passing the selected value in the querystring.

The onsubmit() event in the form calls it, you return false as you don't really want the form to submit, you simply want to execute the js and leave the user on the page they were on.

The <noscript> tag is something you should add to allow visitors who have js turned off to still submit the form - it won't show up unless the user has js turned off.

Code:
<script langauge="javscript" type="text/javascript">
	function doSubmit() {
		var selValue = document.getElementById("lstMain").value;
		window.open("ExSampleAddress.asp?lstMain=" + selValue,"myWindowName","myWindowProperties");
		return false;
	}
</script>
<FORM action="ExSampleAddress.asp" name="frmAdd" target="_blank" class="input" id="frmAdd" [b]onsubmit="return doSubmit();[/b]">
	<% IF NOT RSADDRESSES.EOF OR NOT RSADDRESSES.BOF THEN %>  
	<table width="40%" border="0" align="center">    
		<tr class="TextCentrePlain10px">     
			<td>
				<select name="lstMain" class="TextCentrePlain10px" id="lstMain" onChange="javascript:document.frmAdd.submit(this.form)">              
					<option value="Select Customer">Select Customer</option>       
					<%While (NOT rsAddresses.EOF)%>
						<OPTION value="<%=(rsAddresses.Fields.Item(" customerno ").Value)%>"><%=rsAddresses("CustomerNo") & "   " & left(rsAddresses("Address1"),20) & "   " & rsAddresses("PostCode")%></OPTION>
					<%  
						RSADDRESSES.MOVENEXT
						WEND
						IF (RSADDRESSES.CURSORTYPE > 0) Then  
							rsAddresses.MoveFirst 
						Else  
							rsAddresses.Requery
						End If
					%>
				</SELECT>
				[b]
				<noscript>
					<input type="submit" id="btnSubmit" name="btnSubmit" value="Submit" />
				</noscript>
				[/b]
			</TD>
		</TR>
	</TABLE>
<% END IF ' END NOT RSADDRESSES.EOF OR NOT RSADDRESSES.BOF %></form>

It's just past 10pm where I am and I'm going to bed, I'll check back tomorrow to see if you were able to sort it out or if I can help some more.



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
vickirk,

Thank you for the code you have written for me I will see if I have time today to test this out and will of course let you know the outcome

Regards

Paul

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top