473,840 Members | 1,667 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 11240
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
18093
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 and the value of the fee text box has to be the fee. Can someone please help me in accomplishing...
6
15427
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 = new phaseTypeId(4); var phaseId = new phaseId(4);
1
6369
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 my test code: ************************************************************************ <html>...
4
5787
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
5262
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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
1
2417
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 value="http://www.localwebsolutions.com/local-business-marketing-online.html">Marketing Online</option><option...
5
4014
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
7576
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 the multiple select menu last so that the selections wouldn't clear but then after clicking the...
0
9861
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 usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10924
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10605
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10665
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10301
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7023
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3139
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.