Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2005, 05:28 AM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple combos filled from other combos

Hi guys,
I've got 3 set of combos (kind of city -> zip-code) and I fill both from DB. selecting a value from the first one I fill the second one with the appropriate zip-code. Everything works fine, but my problem is that because I've got 3 set of combos, I have to refresh the page every time somebody selects one of the first combos, and I loose the other data of the form!
I tried with a pop-up, but the page must refresh, mustn't it???!! Please help, I'm not so good at "javascript".
Here is my code:
...........................................
<SCRIPT LANGUAGE=javascript>
<!--
function DoClose(tipo)
{
//this fun. sends to the main page the values selected
//into the popup as querystring format

window.opener.location.replace("./" + window.document.form1.PAG.value + "?TIPO=" + tipo + "&" + window.document.form1.wichCity.value + "=" + window.document.form1.city.value + "&" + window.document.form1.wichZip.value+ "=" + window.document.form1.zip.value);

window.close();
}
function getZipCode()
{
window.location.reload('getZip.asp?PROV=' + window.document.form1.city.value);
}
//-->
</SCRIPT>

<select name="provincia" onChange="return getProvincia();" onSelect="return getProvincia();">
<%
set rsPr = server.CreateObject("ADODB.recordset")
rsPr.Open "select * from TB_CITY order by sigla",objConn,3,1
strSelected = ""
while not rsPr.eof
 if rsPr("sigla") = session("CITY") then
   strSelected = "selected"
 else
   strSelected = ""
 end if%>
 <option value="<%=rsPr("sigla")%>" <%=strSelected%>>
 <%=rsPr("city")%>
 </option>
 <%rsPr.MoveNext
wend
strSelected = ""
rsPr.Close
set rsPr = nothing%>
</select>


<%
set rsCom = server.CreateObject("ADODB.recordset")
rsCom.Open "select * from TB_ZIPCODE where rif_city = '" & _
            session("CITY") & "' order by comune",objConn,3,1%>
<select name="comune" onChange="return doClose(<%=session("tipo")%>);" onSelect="return doClose(<%=session("tipo")%>);">
<%if rsCom.RecordCount > 0 then
    while not rsCom.eof%>
    <option value="<%=rsCom("zip")%>">
         <%=rsCom("zip")%>
        </option>
    <%rsCom.MoveNext
     wend
     rsCom.Close
     set rsCom = nothing
else%>
   <option value ="-1">Select a city</option>
<%end if%>
</select>

<input type="hidden" name="QUALEPR" id="QUALEPR" value="<%=session("qualeProv")%>">
<input type="hidden" name="QUALECOM" id="QUALECOM" value="<%=session("qualeCom")%>">
<input type="hidden" name="PAG" id="PAG" value="<%=session("pag")%>">

 
Old February 1st, 2005, 01:28 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following URLs for dynamic combos:

http://www.learnasp.com/learn/listdynamic.asp
http://www.learnasp.com/learn/listdynamicmore.asp

Om Prakash





Similar Threads
Thread Thread Starter Forum Replies Last Post
create a dialog with a filled listbox PameXXX Visual C++ 0 July 13th, 2007 11:01 AM
Message Box (Show if form not filled out) misskaos Classic ASP Basics 38 October 10th, 2006 02:05 PM
2 synchronous combos in continuous forms Cr0vaX Access VBA 3 May 22nd, 2004 11:40 AM
CheckBoxList filled from SQL.. MichaelTJ .NET Web Services 2 October 11th, 2003 05:11 PM
Counting Users returning to a page they filled out bicho Classic ASP Basics 1 July 6th, 2003 03:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.