469,927 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

can't get value from select box! Help!

Hello,
Why is it that I do get the value from my text box but I cannot get
the value from my select box which is located in the same form? This
is the code I use:

var text1 = frmMain.filter1txt.value;
var sel1 = frmMain.filter1sct.options[frmMain.filter1sct.selectedIndex].value;
<form name="frmMain">
<table align="center" id="Table1" width="600px"">
<tr>
<td>
<SELECT NAME="Filter1sct">
<OPTION VALUE="fclient">client</OPTION>
<OPTION VALUE="fid">sleutelveld</OPTION>
<OPTION VALUE="fusername">username</OPTION>
<OPTION VALUE="fname">naam</OPTION>
<OPTION VALUE="fcity">woonplaats</OPTION>
<OPTION VALUE="fdebno">debiteurnr</OPTION>
</SELECT>
</td>
<td>
<input type="text" name="filter1txt" value="All"><br>
</td>
</tr>
</table>
</form>

Hope someone can help me, thanks a lot! Sharon
Jul 23 '05 #1
2 1609

"Sharon" <es*****@hotmail.com> wrote in message
news:2b**************************@posting.google.c om...
Hello,
Why is it that I do get the value from my text box but I cannot get
the value from my select box which is located in the same form? This
is the code I use:

var text1 = frmMain.filter1txt.value;
var sel1 = frmMain.filter1sct.options[frmMain.filter1sct.selectedIndex].value;

<form name="frmMain">
<table align="center" id="Table1" width="600px"">
<tr>
<td>
<SELECT NAME="Filter1sct">
<OPTION VALUE="fclient">client</OPTION>
<OPTION VALUE="fid">sleutelveld</OPTION>
<OPTION VALUE="fusername">username</OPTION>
<OPTION VALUE="fname">naam</OPTION>
<OPTION VALUE="fcity">woonplaats</OPTION>
<OPTION VALUE="fdebno">debiteurnr</OPTION>
</SELECT>
</td>
<td>
<input type="text" name="filter1txt" value="All"><br>
</td>
</tr>
</table>
</form>

Hope someone can help me, thanks a lot! Sharon

var sel1 =
frmMain.filter1sct.options[frmMain.filter1sct.selectedIndex].value;

<SELECT NAME="Filter1sct">

You should be getting the error: "frmMain.filter1sct.options" is not an
object

It's a classic case of incorrect case.

--
S.C.
Jul 23 '05 #2
Well, actually, I found another error and now it's working properly...
The thing was that first I let users select the column they want to
filter from the select box and then fill in the value on which they want
it to be filtered. So the focus shifts from the select box to the text
box. When I just use
frmMain.filter1sct.value;
I actually get the right result. Thanks anyway!!! Sharon
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by JT | last post: by
6 posts views Thread by Jon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.