By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

can't get value from select box! Help!

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
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.