473,788 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Select and onChange

I have a Dynamic drop-down box that is populated based on a ADO query.
This works fine. I want to capture the users selection and assign it to
a variable for use in another query. I am using the onChange event to
try and capture the users selection but it always passes the last entry
in the drop-down list not what the user selects. Can anyone help me
with this. I am very new to ASP\Jscript\Vbs cript. A snippent of the
code is below.

<select name="cur_mgr"
onchange="setMg r(this.options[this.selectedIn dex].value);">
<option value=""></option>
<%=Manager%>
</select>

Dec 13 '06 #1
3 6832
Michael McGrew wrote:
I have a Dynamic drop-down box that is populated based on a ADO query.
This works fine. I want to capture the users selection and assign it
to a variable for use in another query. I am using the onChange event
to try and capture the users selection but it always passes the last
entry in the drop-down list not what the user selects. Can anyone
help me with this. I am very new to ASP\Jscript\Vbs cript. A snippent
of the code is below.

<select name="cur_mgr"
onchange="setMg r(this.options[this.selectedIn dex].value);">
<option value=""></option>
<%=Manager%>
</select>
This is not really an ASP issue (you'd be having the same problem if
your file had a .htm extension instead of .asp, wouldn't you?): it's a
client-side scripting issue. You haven't shown us enough here to allow
us to reproduce your problem. When you post to the client-side scripting
group (microsoft.publ ic.scripting.js cript) include the setMgr function
code. Also, run your page and View source so you can include the html
for the options in the select element.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 13 '06 #2

Bob Barrows [MVP] wrote:
Michael McGrew wrote:
I have a Dynamic drop-down box that is populated based on a ADO query.
This works fine. I want to capture the users selection and assign it
to a variable for use in another query. I am using the onChange event
to try and capture the users selection but it always passes the last
entry in the drop-down list not what the user selects. Can anyone
help me with this. I am very new to ASP\Jscript\Vbs cript. A snippent
of the code is below.

<select name="cur_mgr"
onchange="setMg r(this.options[this.selectedIn dex].value);">
<option value=""></option>
<%=Manager%>
</select>

This is not really an ASP issue (you'd be having the same problem if
your file had a .htm extension instead of .asp, wouldn't you?): it's a
client-side scripting issue. You haven't shown us enough here to allow
us to reproduce your problem. When you post to the client-side scripting
group (microsoft.publ ic.scripting.js cript) include the setMgr function
code. Also, run your page and View source so you can include the html
for the options in the select element.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
The setMgr function is just simple javascript to set a variable.

function setMgr(curMgr) {
var sMgr = curMgr;
}

I get the variable but it is always the last item in the drop-down
select, it doesn't reflect the selection.

Dec 13 '06 #3

"Michael McGrew" <mc************ @gmail.comwrote in message
news:11******** **************@ 80g2000cwy.goog legroups.com...
>
Bob Barrows [MVP] wrote:
Michael McGrew wrote:
I have a Dynamic drop-down box that is populated based on a ADO query.
This works fine. I want to capture the users selection and assign it
to a variable for use in another query. I am using the onChange event
to try and capture the users selection but it always passes the last
entry in the drop-down list not what the user selects. Can anyone
help me with this. I am very new to ASP\Jscript\Vbs cript. A snippent
of the code is below.
>
<select name="cur_mgr"
onchange="setMg r(this.options[this.selectedIn dex].value);">
<option value=""></option>
<%=Manager%>
</select>
This is not really an ASP issue (you'd be having the same problem if
your file had a .htm extension instead of .asp, wouldn't you?): it's a
client-side scripting issue. You haven't shown us enough here to allow
us to reproduce your problem. When you post to the client-side scripting
group (microsoft.publ ic.scripting.js cript) include the setMgr function
code. Also, run your page and View source so you can include the html
for the options in the select element.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

The setMgr function is just simple javascript to set a variable.

function setMgr(curMgr) {
var sMgr = curMgr;
}

I get the variable but it is always the last item in the drop-down
select, it doesn't reflect the selection.
All the option values are "" so I'm surprised you are getting any value at
all.
Dec 14 '06 #4

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

Similar topics

1
20702
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function init() {
3
4319
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
9
3630
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I can't know what dynamic control I have to create.
4
2148
by: PM ArunKumar | last post by:
i have two dropdown list in my form where the values in the list of second drop down changes based on the value i select in the first dropdown.(very similar to country and states list), here after submitting the form, if i go back the value which i selected in my second dropdown list doesn't appear. for eg: if select USA and virginia ,when i go back USA appears but virginia doesn't appear in my page. can any help me to retain the value....
1
3753
by: skyson2ye | last post by:
Hi, guys: I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem, and I have spent three days trying to debug but to no avail. Everything is OK when there are only two dependent list boxes, but when adding the third child list box, a problem appears: if I populate the third box only with the value: new...
0
1456
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value & update to the database based on the hidden ID. DELETE ALL will delete everything the databse.
0
1990
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value & update to the database based on the hidden ID. DELETE ALL will delete everything the databse.
0
1713
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value & update to the database based on the hidden ID. DELETE ALL will delete everything the databse.
1
2966
by: jmartmem | last post by:
Greetings, I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot. I have a form with a series of dynamic dependent list boxes. Making a selection from list/box A (Qtr) selects a fiscal quarter, which then refreshes the values in list/box B (Mth), which shows the 3 months in that fiscal quarter, which then refreshes the values in list/box C (MthDate), which returns the date...
0
9656
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
9498
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,...
0
10172
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
10110
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
8993
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
7517
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
6750
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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

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.