Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox value = on ,even when not checked! Why is this??

Status
Not open for further replies.

mijulie

Programmer
Jun 21, 2001
36
0
0
IE
This is the code for output to my textfile,

filetxt.WriteLine "Tekelec: "&BuildForm.tLandline.Value
filetxt.WriteLine "D & D: "&BuildForm.dLandline.Value
filetxt.WriteLine "Bearer Data: "&BuildForm.bLandline.Value
filetxt.WriteLine "SoftShelf: "&BuildForm.sLandline.Value

and this is the HTML

<CENTER><INPUT name=tLandLine type=checkbox ></CENTER></TD>
<TD>
<CENTER><INPUT name=&quot;dLandLine&quot; type=checkbox ></CENTER></TD>
<TD>
<CENTER><INPUT name=&quot;bLandLine&quot; type=checkbox ></CENTER></TD>
<TD>
<CENTER><INPUT name=&quot;sLandLine&quot; type=checkbox ></CENTER></TD></TR>

even when i don't check one or more of these, the value in the textfile is equal to on. Can anyone help me with this?
 
Well, it's value is on. It's state is what you need to be checking -- whether or not it's checked. Regardless, though, its value is still on.

Does that make sense?

So, basically, you need to do some if blocks to check its state --

if BuildForm.tLandline.checked then
filetxt.WriteLine &quot;it's checked&quot;
else
filetxt.WriteLine &quot;it's not checked&quot;
end if

If you are reading posted form data, then you can check to see if the value is &quot;ON&quot;. If it wasn't checked, then it's value will be &quot;&quot;. But this is only after the form has been posted. If you are checking client side on the same page before the form is posted, then what you look for is state.

Posted:
if request.form(&quot;tLandline&quot;) = &quot;ON&quot; then

Pre-post (client side):
if document.BuildForm.tLandline.checked then

Hope that clears it up for ya. :)
Paul Prewett
penny.gif
penny.gif
 
The BuildForm.tLandline.checked code worked! Thanks again, u got me out of another hole, thanks!

Mijulie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top