Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Dynamic County List After State List

Posted on 2006-04-02
3
Medium Priority
?
206 Views
Last Modified: 2010-04-25
Hi,

I have a form for user information.  I have a simple "enter your address" form
I am going to post the two <input> value's that i'm having trouble with
I want the form to reload without posting any information to my database once the state has been chosen and then a list of counties in that state will appear in that list.

Any help would be great!!!

Here is my state Dynamic List

<select name="State">
<%
While (NOT Recordset3.EOF)
%><option value="<%=(Recordset3.Fields.Item("State").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("State").Value))) Then If (CStr(Recordset3.Fields.Item("State").Value) = CStr((Recordset1.Fields.Item("State").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset3.Fields.Item("State").Value)%></option>
<%
Recordset3.MoveNext()
Wend
If (Recordset3.CursorType > 0) Then
  Recordset3.MoveFirst
Else
  Recordset3.Requery
End If
%>
</select>

The state is working OK
and here is what I have for county so far.  

<select name="County">
        <%
While (NOT Recordset4.EOF)
%><option value="<%=(Recordset4.Fields.Item("County").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("County").Value))) Then If (CStr(Recordset4.Fields.Item("County").Value) = CStr((Recordset1.Fields.Item("County").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset4.Fields.Item("County").Value)%></option>
        <%
  Recordset4.MoveNext()
Wend
If (Recordset4.CursorType > 0) Then
  Recordset4.MoveFirst
Else
  Recordset4.Requery
End If
%>
      </select>

Please let me know what I need to add to make this work.
Thanks, Austin
0
Comment
Question by:USCBigRed
1 Comment
 
LVL 25

Accepted Solution

by:
Rouchie earned 2000 total points
ID: 16358200
Austin,
Doing this in ASP is going to be tricky if you're not confident with the language.  This is because you'd need to get the first drop down to post back the form to the server when a new selection was made in the list.  The server would then populate the second drop down list.  The problem is that you'd have to differentiate to the server whether the form has actually been completely filled in and submitted by the user, or whether the first list had just been changed.
If your county values are being pulled from a database, then you will probably have to use ASP to get the values.  However, I don't see this information changing very often (!), so I'd recommend using javascript to populate the list instead.  This also means you don't need to post back when a new state is chosen.

Macromedia's official tutorial on how to do this is here, http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14924
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question