473,770 Members | 5,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieving the choise of a combo box

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 value and a
string. This is done through a javascript and it uses the numeric
values of the first box. When submitting the page to an asp script I
don't want to post these numeric values but the selected strings. Can
this be done???

Regards, Klaas Seelen
Jul 22 '05 #1
5 2711
Klaas Seelen wrote:
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 value and a
string. This is done through a javascript and it uses the numeric
values of the first box. When submitting the page to an asp script I
don't want to post these numeric values but the selected strings. Can
this be done???

You will only be able to see the values in the submitted data. So force the
value property or the options to contain the strings you want to post
instead of the numeric values. There is no requirement that the value
property has to be something different from the text property of the option.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Klaas Seelen wrote:
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 value and a
string. This is done through a javascript and it uses the numeric
values of the first box. When submitting the page to an asp script I
don't want to post these numeric values but the selected strings. Can
this be done???


Let me first state that I would be inclined to get rid of the numbers
altogether. If you are not interested in them at submission, why bother
putting them into the document in the first place?

Back to your question. There are several ways to do this. Perhaps the most
straightforward is to change the value at submit:

option.value = option.text // [1],[2]

If your SELECT elements (they are not "comboboxes ") are of the "select-one"
type [3], then it suffices to do it this way:

sel[sel.selectedInd ex].value = sel[sel.selectedInd ex].text

For "select-multiple" elements, you should iterate through the entire set of
option elements.

Please bear in mind that "option" and "sel" are object references,
representing something like
document.forms["myForm"].elements["mySelectElemen t"][i] and
document.forms["myForm"].elements["mySelectElemen t"], respectively.
[1]
http://msdn.microsoft.com/workshop/a...es/value_3.asp
[2]
http://msdn.microsoft.com/workshop/a...ies/text_3.asp
[3]
http://msdn.microsoft.com/workshop/a...ies/type_9.asp
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #3
I have thought of that one too, the problem is I need the numeric values for
my javascript to dynamically fill te second and third box so I hope ther is
an other solution...

Klaas Seelen

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> schreef in bericht
news:eP******** ******@TK2MSFTN GP15.phx.gbl...
Klaas Seelen wrote:
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 value and a
string. This is done through a javascript and it uses the numeric
values of the first box. When submitting the page to an asp script I
don't want to post these numeric values but the selected strings. Can
this be done???

You will only be able to see the values in the submitted data. So force
the value property or the options to contain the strings you want to post
instead of the numeric values. There is no requirement that the value
property has to be something different from the text property of the
option.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 22 '05 #4
You have two choices:

Use client-side code (as suggested by Dave) to either either of these
actions on submit:
a. modify the selected option elements
b. populate hidden textboxes with the values of the selects
Use server-side code to retrieve the strings that correspond to the numeric
values from whatever source is used to provide the data for the "combos"
(note: there is no such thing as a "combo" in html - you have select
elements). Provide a little more info and we may be able to help you with
this.

Klaas Seelen wrote:
I have thought of that one too, the problem is I need the numeric
values for my javascript to dynamically fill te second and third box
so I hope ther is an other solution...

Klaas Seelen


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #5
Thanks a lot, it worked...

Klaas Seelen

"Dave Anderson" <GT**********@s pammotel.com> schreef in bericht
news:ud******** ********@tk2msf tngp13.phx.gbl. ..
Klaas Seelen wrote:
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 value and a
string. This is done through a javascript and it uses the numeric
values of the first box. When submitting the page to an asp script I
don't want to post these numeric values but the selected strings. Can
this be done???


Let me first state that I would be inclined to get rid of the numbers
altogether. If you are not interested in them at submission, why bother
putting them into the document in the first place?

Back to your question. There are several ways to do this. Perhaps the most
straightforward is to change the value at submit:

option.value = option.text // [1],[2]

If your SELECT elements (they are not "comboboxes ") are of the
"select-one" type [3], then it suffices to do it this way:

sel[sel.selectedInd ex].value = sel[sel.selectedInd ex].text

For "select-multiple" elements, you should iterate through the entire set
of option elements.

Please bear in mind that "option" and "sel" are object references,
representing something like
document.forms["myForm"].elements["mySelectElemen t"][i] and
document.forms["myForm"].elements["mySelectElemen t"], respectively.
[1]
http://msdn.microsoft.com/workshop/a...es/value_3.asp
[2]
http://msdn.microsoft.com/workshop/a...ies/text_3.asp
[3]
http://msdn.microsoft.com/workshop/a...ies/type_9.asp
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms. Please do not
contact me directly or ask me to contact you directly for assistance. If
your question is worth asking, it's worth posting.

Jul 22 '05 #6

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

Similar topics

0
1362
by: Mark | last post by:
Hi Bit of an unusual one. I have an Access front end. Two tables tblHeader and tblDetails. Each has an ID field (unique and primary) plus other fields as necessary. On aform is 3 fields from the header: 1. A text field 2. A SupplierID field (combo dropdown) 3. A SupplierBranchID field (combo dropdown)
10
1702
by: Krakatioison | last post by:
Hi everyone, can someone point me to download of an example for saving and retrieving to/from MYSQL database. Or did anyone of you tried this and could share your code with me. I've got some data which needs to be put to mysql database using VB.NET and I can't figure this out. Thanks a lot. K.
5
6630
by: Edward Clements | last post by:
I have an enum defined as public enum velocityUom { /// <remarks/> ms, /// <remarks/> cma, ...
0
1611
by: Edward Clements | last post by:
This post is a followup to the thread "retrieving the XmlEnumAttribute values for an Enum" in this same forum earlier this month, since my last query in that thread went unanswered. I have an enum defined (DotNet v2) as public enum velocityUom { ms = 21,
10
2771
by: shanmukhi | last post by:
hi all in jsp i created a combo box and i written a java script to select values from combo box. when i select a value from combo box it should go to the another jsp page for that i passed the selected value as a string along with the url in java script. like <a href=..........?<%=val%> then how can i get this value into another jsp page. please any body can help me.....
2
6222
by: radziowi | last post by:
Hello! I have got problem with date in SQL query. I would like choise date bettwen 2 dates for example SQL query select * from news WHERE data BETWEEN 24-07-2007 AND 06-08-2007 In SQL working but when i use Cold Fusion my query is still wrong <cfset today = Now()> <cfoutput>#DateFormat(today, "dd-mmm-yyyy")#</cfoutput> <cfquery name="News" datasource="#DSNname#"> SELECT * FROM News WHERE Date = #DateFormat(today,...
0
1168
by: sanalsuryakalady | last post by:
Hello All, I have 2 combo box in ASP.NET 1.1. When ever I change the value in one combo the other combo will be loaded with the new values using XMLHTTP.But when I post back the screen I lose the newly added values in Combo and the first values when the page loaded will appear in the code behind. If any body knows a solution to this pls let me know
9
9921
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 box, based on the selection of the value in that combo box, b.jsp page gets populated with the value associated to a.jsp, and again based on the selection of value of the 2nd combobox my 3rd combo box gets populated, which is in c.jsp. I'm able to...
4
6074
by: Luqman | last post by:
I am using Visual studio 2008 and ASP.Net 3.5 How can I fill a combo with List of Local Printers, installed on Client Machine ? If I have to buy any Activex Control from Internet, please do recommend. Best Regards, Luqman
0
9591
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
9425
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10001
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
8880
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
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();...
1
3969
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
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.