Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 13th, 2006, 04:45 PM
Michael McGrew
Guest
 
Posts: n/a
Default 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\Vbscript. A snippent of the
code is below.

<select name="cur_mgr"
onchange="setMgr(this.options[this.selectedIndex].value);">
<option value=""></option>
<%=Manager%>
</select>

  #2  
Old December 13th, 2006, 05:25 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Dynamic Select and onChange

Michael McGrew wrote:
Quote:
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\Vbscript. A snippent
of the code is below.
>
<select name="cur_mgr"
onchange="setMgr(this.options[this.selectedIndex].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.public.scripting.jscript) 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.


  #3  
Old December 13th, 2006, 06:25 PM
Michael McGrew
Guest
 
Posts: n/a
Default Re: Dynamic Select and onChange


Bob Barrows [MVP] wrote:
Quote:
Michael McGrew wrote:
Quote:
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\Vbscript. A snippent
of the code is below.

<select name="cur_mgr"
onchange="setMgr(this.options[this.selectedIndex].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.public.scripting.jscript) 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.

  #4  
Old December 14th, 2006, 10:26 PM
Anthony Jones
Guest
 
Posts: n/a
Default Re: Dynamic Select and onChange


"Michael McGrew" <mcgrew.michael@gmail.comwrote in message
news:1166035986.578349.154500@80g2000cwy.googlegro ups.com...
Quote:
>
Bob Barrows [MVP] wrote:
Quote:
Michael McGrew wrote:
Quote:
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\Vbscript. A snippent
of the code is below.
>
<select name="cur_mgr"
onchange="setMgr(this.options[this.selectedIndex].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.public.scripting.jscript) 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.


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles