?
Solved

Option button in ASP

Posted on 2004-03-26
5
Medium Priority
?
311 Views
Last Modified: 2012-08-14
Hi,

Here is the scenario, I want the user to choose the country from the list and once the user click on the country then the other option button will list down the state of the country selected by the user without click on the submit button.
It just like the sign up page in the hotmail.
I am using access to retrieve the country.
How to do this? And is it possible all this things done in the same page without have to link to other page?

Thanks in advance
Yzh
0
Comment
Question by:Yzh
5 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10693884
0
 
LVL 12

Expert Comment

by:str_kani
ID: 10694060
hi,
Will you display all the countries in the world or only a few and its states, we can choose  the best one depends on the requirement. Please let me know how many countries and states you will use...
(tell me approximately)
regards
kani
0
 

Author Comment

by:Yzh
ID: 10700807
Well, I will put 10 countries but in the future I may put more..so, I want it to be dynamic..which approach is better? client-side or server-side?

Regards,
Yzh
0
 
LVL 1

Expert Comment

by:Nandhini
ID: 10958551
server side is the best approach
0
 
LVL 1

Accepted Solution

by:
Nandhini earned 320 total points
ID: 10965992
it is possible to do in a single page

page - first.asp
-----------------

<%
  ur connection stmt .............
%>
<html>
<body>
<form name="form1" method="post" action="first.asp">
<select name="country" onchange="javascript:form1.submit();">
<%
   select all the countries from the database
    If not cnt.eof then
     cnt.movefirst
     If Request.Form("country") <> "" then
       country = Request.Form("country")
     Else
       country = cnt("country_field_name")
     End If
     Do while not cnt.eof
      If strcomp(country,cnt("country_field_name"),1) = 0 then
%>
        <option value="<%=cnt("country_field_name")%>"><%=cnt("country_field_name")%> SELECTED></option>
<%
      else
%>
        <option value="<%=cnt("country_field_name")%>"><%=cnt("country_field_name")%></option>
<%
       end if
      cnt.movenext
    loop
    end if
 %>
</select>
<select name="state">
<%
  set st = conobj.execute("select states from state_table_name where country='"&country&"'")
  If not st.eof then
   st.movefirst
   Do while not st.eof
%>
     <option value="<%=st("state")%>"><%=st("state")%></option>
<%  
    st.movenext
   Loop
  end if
%>
</select>
</form>
</body>
</html>
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 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