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

How to create popup selection screens in ASP.

Status
Not open for further replies.

BazR

Programmer
Joined
May 28, 2003
Messages
9
Location
GB
What is the prefferred method of creating popup selection screens within ASP?

Have created an ActiveX DLL that displays information retrieved from database for selection, and VBscript to invoke this COM object, upon OnClick events and OnBlur Events, but this then means (as using VBSCript) that DLL has to be on each client??

Any Ideas?
 
Since you don't know if the .dll is going to be there, you should use javascript to open a new window that has an asp page in it....

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Do you happen to have an example of how this can be done?

Possibley in VBScript too, if you have one.

Thanks in advance,

Barry.
 
Please explain a little more what you are trying to do in the main window and the pop window.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
I need to be able to create a selection popup (i.e. Customer Selecttion screen), so the new window being opened would have to have a datagrid on there so that I could drop a recordset in there for user to select account to be retrieved.
 
main.htm
<script>
function showList(){
window.open(&quot;pop.asp&quot;,&quot;popWin&quot;)
}
</script>

<form name=&quot;myForm&quot;>
<input name=&quot;customer&quot;>
<input type=button value=&quot;Show List&quot; onClick=&quot;showList()&quot;>
</form>



pop.asp
<%
set cn = server.createobject(&quot;adodb.connection&quot;)
cn.open application(&quot;connectString&quot;)
set rs = cn.execute(&quot;Select customer FROM myTable&quot;)
optionStr = &quot;<option value=''>&quot;
do while not rs.eof
optionStr = optionStr & &quot;<option value='&quot; & rs(0) & &quot;'>&quot; & rs(0)
rs.movenext
loop
%>

<script>
function setValue(){
chosenVal = document.subForm.customerList.options[document.subForm.customerList.selectedIndex].value
window.opener.myForm.customer.value = chosenVal
self.close()
}
</script>
<form name=&quot;subForm&quot;>
<select name=&quot;customerList&quot; onChange=&quot;setValue()&quot;>
<%=optionStr%>
</select>
</form>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Excellent thanks.

Didn't think to use a List (kept thinking along the lines of embedding a Grid Control somehow)

Thanks again.
 
That works really well.

Is it possible (out of interest) to do the same using VBScript??
 
Yes. However, you have to remember that vbScript only works in Internet Explorer.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Are you able to show me an example of how this would work in VBScript?
 
If it works fine in javascript, why do you need a vbScript function?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Only so that I know how it is done, as am un-familiar with JScript.
 
But your server-side code doesn't change. Only the client-side functions that were written in javascript would then be written in vbScript. I actually haven't written client-side vbScript to pop windows and repopulate opener forms. I'm sure it can be done, I just have no reason to do it...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top