473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Retrieving values from select option

219 100+
How do I go about retrieving the inner text from select options with asp? I am using the values to do some calculations, but I want to retrieve the inner text of the option field for display purposes, how would I go about doing this?

Expand|Select|Wrap|Line Numbers
  1. <select name="refresh_rate" id="refresh_rate" onChange="set_refresh_rate(this);return false;">
  2.     <option value="60">60 Seconds</option>
  3.         <option value="30">30 Seconds</option>
  4.         <option value="15">15 Seconds</option>
  5. </select>
  6.  
Jun 24 '08 #1
3 1906
DrBunchman
979 Expert 512MB
Unfortunately, you can't.

If you want to retrieve the option text then you'll need to include it in the value field separated by some sort of delimiter and then split the value back into two when you request it. Here's an example:
Expand|Select|Wrap|Line Numbers
  1.  <select name="DropDown1"> 
  2.    <option value="A£Option 1">Option 1</Option>
  3.    <option value="B£Option 2">Option 2</Option>
  4. </select>
  5.  
  6. <%
  7. Dim sDropDown1, sValue, sText
  8. sDropDown1 = Request.Form("DropDown1")
  9. If InStr(sDropDown1, "£") > 0 Then
  10.      sValue = Split(sDropDown1, "£")(0)
  11.      sText= Split(sDropDown1, "£")(1)
  12. End If
  13. %>
  14.  
The split function literally splits the string up at the selected point (in this case when it finds a £ sign) and assigns it to our two variables.

Let me know if this helps,

Dr B
Jun 24 '08 #2
dmorand
219 100+
That's what I figured I'd have to do. Thanks Dr B!!!
Jun 24 '08 #3
DrBunchman
979 Expert 512MB
My pleasure....

Dr B
Jun 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Klaas Seelen | last post by:
Hi, On a webpage I have three comboboxes. The second and the third are dynamically filled dependent from the choice in the first combobox. Each choice in all three boxes consist of a numeric...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
2
by: Parz | last post by:
Hi am facing problem in retrieving the value selected from drop down menu in one page from the next page..Am using the following code to populate the drop down menu with values form the database. ...
15
by: gunnar.sigurjonsson | last post by:
I“m having some problem retrieving identity value from my newly inserted row into a view. I have two tables T1 and T2 which I define as following CREATE TABLE T1 ( id BIGINT GENERATED ALWAYS...
6
by: dream2rule | last post by:
<form action='' method='post' name='create_table_form' id='create_table_form' > <table border='0' cellpadding='0' cellspacing='0' width='95%'><tr><td><br /> <table border='0' cellpadding='0'...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
9
by: ajos | last post by:
Hello friends, After thinking about this for sometime, i decided to post this in the java forum. Well my problem here in detail is, i have 3 jsp pages where in a.jsp(for example) i have a combo...
1
by: fidgen | last post by:
Hiya, I'm trying to get a AJAX driven update to my list of news articles, so when users click the title of the news article, it pops up the article content in a thickbox overlay. Retrieving...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...

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.