473,545 Members | 2,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamically populate drop down menu option value problem

hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresult s1.asp"
<%else%>
action="xresult s.asp"
<%end if%>
method="get">

<%

if isempty(Applica tion("Recordset 2strcacheUsers" )) then

Set db = Server.CreateOb ject("ADODB.Con nection")
db.Open MM_database2_ST RING

Set Recordset2 = db.Execute("SEL ECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populat e drop down list********

Recordset2str = "<SELECT NAME=subject><O PTION
value=choose>Su bject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fiel ds("Field2") & ">" & Recordset2.fiel ds("Field2") &
"</OPTION>"
Recordset2.move Next
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write( "<br>from database<br>" & Recordset2str)

'********write to cache********** *
Application.loc k()
Application("Re cordset2strcach eUsers") = Recordset2str
Application.unl ock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write( "<BR>from cache<BR>" & Application
("Recordset2str cacheUsers"))

end if
%>

</form>
Jul 19 '05 #1
3 11228
Enclose your values in quotes.

Recordset2str = Recordset2str & "<OPTION VALUE=""" &
Recordset2.fiel ds("Field2") & """>" & Recordset2.fiel ds("Field2") &
"</OPTION>"

Ray at home

--
Will trade ASP help for SQL Server help
"julian" <ju***********@ talk21.com> wrote in message
news:19******** *************** ***@posting.goo gle.com...
hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresult s1.asp"
<%else%>
action="xresult s.asp"
<%end if%>
method="get">

<%

if isempty(Applica tion("Recordset 2strcacheUsers" )) then

Set db = Server.CreateOb ject("ADODB.Con nection")
db.Open MM_database2_ST RING

Set Recordset2 = db.Execute("SEL ECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populat e drop down list********

Recordset2str = "<SELECT NAME=subject><O PTION
value=choose>Su bject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fiel ds("Field2") & ">" & Recordset2.fiel ds("Field2") &
"</OPTION>"
Recordset2.move Next
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write( "<br>from database<br>" & Recordset2str)

'********write to cache********** *
Application.loc k()
Application("Re cordset2strcach eUsers") = Recordset2str
Application.unl ock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write( "<BR>from cache<BR>" & Application
("Recordset2str cacheUsers"))

end if
%>

</form>

Jul 19 '05 #2
thx ray.
always boils down to punctuation!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
you need to enclose the value with ""... i.e.
Recordset2str = "<SELECT NAME=subject><O PTION
value=choose>Su bject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=""" &
Recordset2.fiel ds("Field2") & """>" & Recordset2.fiel ds("Field2") &
"</OPTION>"
Recordset2.move Next
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write( "<br>from database<br>" & Recordset2str)
"julian" <ju***********@ talk21.com> wrote in message
news:19******** *************** ***@posting.goo gle.com... hi

I was wondering if anyone can help me out on this....

I have dynamcally populated a drop down menu with data from an access
database using ASP. The values seem fine, however when i pass them to
the next page (using form get method) the whitespaces in the values
are ignored. For example with <option value=jim jones> then only "jim"
gets passed to the next page not "jim jones". I have viewed the source
created on the dynamic page and the values are populated fine, but
passing to the next page seems to be problematic...

My code....

<form name="search2"
<%if registered then%>
action="xresult s1.asp"
<%else%>
action="xresult s.asp"
<%end if%>
method="get">

<%

if isempty(Applica tion("Recordset 2strcacheUsers" )) then

Set db = Server.CreateOb ject("ADODB.Con nection")
db.Open MM_database2_ST RING

Set Recordset2 = db.Execute("SEL ECT DISTINCT Field2 FROM IaxData WHERE
Field19 = '1'")

'*******populat e drop down list********

Recordset2str = "<SELECT NAME=subject><O PTION
value=choose>Su bject</OPTION>"
while not Recordset2.eof
Recordset2str = Recordset2str & "<OPTION VALUE=" &
Recordset2.fiel ds("Field2") & ">" & Recordset2.fiel ds("Field2") &
"</OPTION>"
Recordset2.move Next
wend

Recordset2str = Recordset2str & "</SELECT>"
Response.write( "<br>from database<br>" & Recordset2str)

'********write to cache********** *
Application.loc k()
Application("Re cordset2strcach eUsers") = Recordset2str
Application.unl ock()

db.Close
Set db = Nothing

else
' Write from cache
Response.write( "<BR>from cache<BR>" & Application
("Recordset2str cacheUsers"))

end if
%>

</form>

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
18055
by: C. David Rossen | last post by:
Hello: I have a registration form for classes. Each class has a fee. I have a drop down box whereby the user chooses his class. There is a textbox with the associated fee. I would like to auto populate the fee textbox depending on what class the user chooses. In the email, the value of the drop down box has to be the name of the class...
6
15398
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens because I am not getting any errors on the page. <html> <script language="javascript"> var phaseArray = new phaseArray(4); var phaseTypeId =...
1
6344
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop down #2 populates. Does anyone know how to get drop down #2 to populate based on what is selected in drop down #1 when the page loads? Here is...
4
5754
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
5244
by: Boujii | last post by:
Greetings, I have been attempting to make a drop down menu of countries. From this menu I wish to create a variable in order to INPUT into mysql database. I have no trouble making the drop down menu, but I am unable to store a variable for it. Here is a rough copy of what I am making: <html> <head> <title>Add New MySQL User</title> ...
1
2395
by: Kaland | last post by:
Do the search engines follow links that are within forms (like the drop-down menu) so that those pages are indexed? Here is the code for a sample drop-down menu that I created. <form><select name="menu" style="font-family:'Calligrapher';color:#993333;background-color:#FFFFFF;font-size:10pt;"><option...
5
3977
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make Fields Names: countrycode, make
6
7543
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created the problem that when I went to select the other drop down menus, the selections i made on the multiple select one would clear. Then I had tried putting...
0
7502
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7434
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7946
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7791
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.