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

x
?
Solved

I need an expert who can help me in solving this selectbox problem.

Posted on 2004-11-26
17
Medium Priority
?
244 Views
Last Modified: 2012-06-27
Hello all experts,
I have got this 2 options for the user, here is what is said to him but i want to simplify this
for the user more than that :
if your business is located in the following area(Group A):
Colorado, Connecticut, Delaware, Maine, Maryland, Massachusetts, Montana, New Hampshire, North Dakota
Pennsylvania, Rhode Island, South Dakota, Utah, Vermont, Virginia, Washington, D.C. West Virginia and Wyoming

Please send your package to: Philadelphia
 
and if it is located in the following regions:

Alabama, Alaska, Arizona, Arkansas, California, Florida, Georgia, Guam, Hawaii, Idaho, Illinois, Indiana, Iowa,
Kansas, Kentucky, Louisiana, Michigan, Minnesota, Mississippi, Missouri, Nebraska, Nevada, New Jersey, New
York, New Mexico, North Carolina, Ohio, Oklahoma, Oregon, Puerto Rico, South Carolina, Tennessee, Texas, Virgin
Islands, Washington and Wisconsin

Please send your package to: San Francisco

so i want this to be represtented in this way :
the user will have a selectbox with all the regions and when he selects any region
the address that this package is supposed to be sent to, should be filled in another field automatically.

So here is what is in  my mind its just the logic:

if the user selects any region in group A then
FIELD Address.value = Philadelphia
else
FIELD Address.value = San Francisco

would someone help my in this code?if someone have a better solution for this ,that will be greate.
 Thanks in advance.
0
Comment
Question by:Melfeky
17 Comments
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683680
How does THIS work out for ya!?

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 100
rs.open

Address1 = "123 Sesame Street, Albuquerque, NM"
Address2 = "456 Elm Street, Las Vegas, NV"

sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<input type="text" name="strAddress">
</form>
0
 
LVL 1

Expert Comment

by:QuazzMoto
ID: 12683692
I think you're going about it the right way.
Just put an event on that drop down list and call a javascript function. such as <dropdownlist name="list1" onClick = "fillField();">
and whatever else.  Then put this in a script block.

function fillField()
{
   if(document.form1.ddRegion.value == "whatever")
      docuement.form1.txtSendTo.value = "San Fran";
   else if(document.form1.ddRegion.value == "whateverelse")
       document.form1.txtSendTo.value = "Florida";

}

Yours will be a bit more complicated, but that is the jist of it.  You already have the logic though.
0
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683709
Ya, I was thinking javascipt at first, but since this was in the ASP channel I went the ASP route
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683712
Not to mention this way will automatically fill out and sort all the Region names for you.
0
 

Author Comment

by:Melfeky
ID: 12683718
Hello AgentSmith,
i have tried ur code and it works finr but when i added the actual address which is something like this:
Address1 = "Small Business Administration
Division of Program Certification and Eligibility
Robert N.C. Nix Federal Building
900 Market Street, 5th Floor
Philadelphia, PA 19107"

Address2 = "Small Business Administration
Division of Program Certification and Eligibility
455 Market Street, 6th Floor
San Francisco, CA 94105"

I got an error:
Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/pdf1/address.asp, line 8, column 41
Address1 = "Small Business Administration
0
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683724
This option will allow you to put line breaks in your address:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 100
rs.open

Address1 = "123 Sesame Street" & chr(10) & "Albuquerque, NM"
Address2 = "456 Elm Street" & chr(10) & "Las Vegas, NV"

sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="5"></textarea>
</form>
0
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683735
Here ya go:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="7"></textarea>
</form>
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 12683741
If you are using a select box then you can simply set the value as either "San Francisco" or "Philadelphia". Something like:

<html>
    <head>
        <script language="javascript">
            function SetDestination( obj )
            {
                document.getElementById("Dest").value = obj.value
            }
        </script>
    </head>
    <body>
        <form>
            Select your region:
            <select name="cboRegion" id="cboRegion" onchange="SetDestination(this);">
                <option value="Philadelphia">Colorado</option>
                <option value="Philadelphia">Delaware</option>
                <option value="San Francisco">Alabama</option>
                <option value="San Francisco">Arizona</option>
            </select>
            <br>
            Destination: <input type="text" name="Dest" id="Dest" DISABLED>
        </form>
    </body>
</html>

Of course, if you use this method then you won't be able to get the selected city when the form is submitted.

Hope this helps.
0
 

Author Comment

by:Melfeky
ID: 12683750
QuazzMoto ,
i have tried ur solution but i got nothing, would you check it and let me know whats wrong,
 here is the form,
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function fillField()
{
   if(document.form1.ddRegion.value == "Ohio")
      docuement.form1.txtSendTo.value = "San Fran";
   else if(document.form1.ddRegion.value == "Virgin")
       document.form1.txtSendTo.value = "Florida";

}

</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
  <select name="list1" onClick = "fillField();">
    <option>Ohio</option>
    <option>Oklahoma</option>
    <option>Tennessee</option>
    <option>Virgin</option>
  </select>
  <input type="text" name="ddRegion">
</form>
</body>
</html>
0
 

Author Comment

by:Melfeky
ID: 12683760
Agentsmith ,
it works fine now, thanks.
0
 
LVL 9

Accepted Solution

by:
AgentSmith007 earned 2000 total points
ID: 12683768
Melfeky, have you tried my latest posted solution? This answers your question quite completely:

<%
set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
      rs.AddNew
      rs("Region") = Region
      rs("Address") = Address
      rs.Update
      rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
      oItem = document.forms.frmRegions.strRegion;
      destination = oItem.options[oItem.selectedIndex].value;
      document.forms.frmRegions.strAddress.value=destination;
}
</script>
<form name="frmRegions">
<select name="strRegion" onChange="fShowAddress()">
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
      <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
      rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="strAddress">-->
<textarea name="strAddress" cols="40" rows="7"></textarea>
</form>
0
 

Author Comment

by:Melfeky
ID: 12683773
yes , i did, and by the way this is exactly what i wanted.
But let me first read through your code so i can get the whole idea of your code.
0
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 12683778
ok...it basically uses the ADO recordset object which allows for easy sorting & future modification with ease. A javascript or other solution is quite feasible without this built-in sorting functionality, but since this is the ASP channel, I figured i'd give you an ASP solution
0
 

Author Comment

by:Melfeky
ID: 12683898
AgentSmith,
I have tested your code in the form that u have given me befor , and i have changed the field name to address and region only, and i have set the field name in the access db too to be the same.
When the form opens everything is fine about the select boxs and when submitting the form i got nothing saved in the db, Would u tell me why is that?
Here is the whole code:
<%
'Declare connection object
 Dim straccessdb, conn, strcon
 strAccessDB = "db1.mdb"
 Set Conn = Server.CreateObject("ADODB.Connection")
 strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(strAccessDB)
 conn.Open strCon

'Function to make SQL statements not fail w/ special character(s)
function fQueryFriendly(strVar)
     strTemp = strVar
     strTemp = Replace(strTemp,"'","''")
     fQueryFriendly = strTemp
end function
'Set current user
dim M_USERNAME
M_USERNAME = session("user")
       
if request.form("iSaveAll") = "1" then
       'Saving entire form
     strSQL = "UPDATE check SET "
     strSQL = strSQL & "Region = '" & fQueryFriendly(request.form("Region")) & "'"
     strSQL = strSQL & ",Address = '" & fQueryFriendly(request.form("Address")) & "'"


      
      
        strSQL = strSQL & "WHERE M_USERNAME = '" & session("user") & "'"
     conn.execute(strSQL)
End If


'read from db
strSQL ="SELECT * FROM check WHERE M_USERNAME = '" & Session("user") & "'"
Set oRS = conn.Execute(strSQL)
while not oRS.Eof
     'get the data
     Region = oRS("Region")
     Address = oRS("Address")

        
        
        oRS.MoveNext
wend
oRS.close
set oRS = nothing

set rs=Server.CreateObject("ADODB.recordset")
'If you don't have SQL Server installed, you'll have to enter the VALUE of the DataTypeEnum, for example, below, 200 is a string, 3 is an integer...complete list can be found here: http://www.devguru.com/Technologies/ado/quickref/recordset_fieldscollection.html
rs.Fields.Append "Region",200,100
rs.Fields.Append "Address", 200, 200
rs.open

Address1 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "Robert N.C. Nix Federal Building" & chr(10) & "900 Market Street, 5th Floor" & chr(10) & "Philadelphia, PA 19107"
Address2 = "Small Business Administration" & chr(10) & "Division of Program Certification and Eligibility" & chr(10) & "455 Market Street, 6th Floor" & chr(10) & "San Francisco, CA 94105"


sub AddItem(Region,Address)
     rs.AddNew
     rs("Region") = Region
     rs("Address") = Address
     rs.Update
     rs.movelast
end sub
'Adding a row (You can prolly simplifily this with a function)
AddItem "Colorado",Address1
AddItem "Connecticut",Address1
AddItem "Delaware",Address1
AddItem "Maine",Address1
AddItem "Maryland",Address1
AddItem "Massachusetts",Address1
AddItem "Montana",Address1
AddItem "New Hampshire",Address1
AddItem "North Dakota",Address1
AddItem "Pennsylvania",Address1
AddItem "Rhode Island",Address1
AddItem "South Dakota",Address1
AddItem "Utah",Address1
AddItem "Vermont",Address1
AddItem "Virginia",Address1
AddItem "Washington, D.C.",Address1
AddItem "West Virginia",Address1
AddItem "Wyoming",Address1

AddItem "Alabama",Address2
AddItem "Alaska",Address2
AddItem "Arizona",Address2
AddItem "Arkansas",Address2
AddItem "California",Address2
AddItem "Florida",Address2
AddItem "Georgia",Address2
AddItem "Guam",Address2
AddItem "Hawaii",Address2
AddItem "Idaho",Address2
AddItem "Illinois",Address2
AddItem "Indiana",Address2
AddItem "Iowa",Address2
AddItem "Kansas",Address2
AddItem "Kentucky",Address2
AddItem "Louisiana",Address2
AddItem "Michigan",Address2
AddItem "Minnesota",Address2
AddItem "Mississippi",Address2
AddItem "Missouri",Address2
AddItem "Nebraska",Address2
AddItem "Nevada",Address2
AddItem "New Jersey",Address2
AddItem "New York",Address2
AddItem "New Mexico",Address2
AddItem "North Carolina",Address2
AddItem "Ohio",Address2
AddItem "Oklahoma",Address2
AddItem "Oregon",Address2
AddItem "Puerto Rico",Address2
AddItem "South Carolina",Address2
AddItem "Tennessee",Address2
AddItem "Texas",Address2
AddItem "Virgin",Address2
AddItem "Islands",Address2
AddItem "Washington",Address2
AddItem "Wisconsin",Address2

rs.movefirst
rs.sort="Region"
%>
<script>
function fShowAddress(){
     oItem = document.forms.frmRegions.Region;
     destination = oItem.options[oItem.selectedIndex].value;
     document.forms.frmRegions.Address.value=destination;
}
</script>
<form name="frmRegions" method="POST">
<select name="Region" onChange="fShowAddress()" >
<option value="" selected>Select your region</option>
<%
while not rs.EOF
%>
     <option value="<%= rs("Address") %>"><%= rs("Region") %></option>
<%
     rs.movenext
wend
%>
</select>
<br>
Address:<br>
<!--<input type="text" name="Address">-->
<textarea name="Address" cols="40" rows="7" value="<%= Address %>"></textarea>
  <input type="submit" name="Submit" value="Submit">
</form>
0
 

Author Comment

by:Melfeky
ID: 12683996
Any way , i shall close this question now as my last question shall be put into another topic because my question was answered here.
Agentsmith,
if u have some time would u check it here in this link:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21221457.html
0
 

Author Comment

by:Melfeky
ID: 12686110
Agentsmith,
the problem of saving into the db is solved but unfortunatlly it is solved in a wrong way,
in this way:
The region field should save only the selected region(South Carolina,Tennessee,etc...)
but it saves thie value that is supposed to be for the address which is this:
"Small Business Administration
Division of Program Certification and Eligibility
Robert N.C. Nix Federal Building
900 Market Street, 5th Floor
Philadelphia, PA 19107"


But the address field saves  always:"Small Business Administration" in it.
Would you look throught the code and let me know whats going wrong
 Thanks
0
 

Author Comment

by:Melfeky
ID: 12686116
you can answer me this question in this topic:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21221457.html
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
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

581 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