?
Solved

Checkbox always return empty string!

Posted on 2011-09-04
5
Medium Priority
?
256 Views
Last Modified: 2012-05-12
Hi, I have the following checkbox
<input type="checkbox" value="chkterm" name="chkterm" id="chkterm"  style="BACKGROUND:#f4f4f4" onClick="EnableSubmit();" >

and I read it like the following:
Request.form("chkterm")
But it always returns an empty string even if the checkbox is checked!

Any suggestion?
0
Comment
Question by:Sindibad_123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 13

Expert Comment

by:Cedric Obinna A.
ID: 36480305
Try changing the name to something else (say chkbox) to differentiate it from the value and try again.
0
 

Author Comment

by:Sindibad_123
ID: 36480342
that makes no difference.
0
 
LVL 13

Expert Comment

by:samic400
ID: 36480374
How is the <form> tag set up? Is the method=post?
0
 
LVL 29

Expert Comment

by:sammySeltzer
ID: 36480400
What is the data type on your db?
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 36482289
Let's say you always wanted it to be checked, then it would look something like this
<input name="chkterm" type="checkbox" id="chkterm"  style="BACKGROUND:#f4f4f4" onClick="EnableSubmit();" value="chkterm" checked="checked" >

Open in new window


So to dynamically make it work you can do a couple options like....


 Option 1
<%
dim strChkterm
if Request.form("chkterm")=<>"" then
       strChkterm=Request.form("chkterm")
end if
%>


<input type="checkbox" value="chkterm" name="chkterm" id="chkterm" <%If strChkterm = "chkterm" Then Response.Write("checked=""checked""") else Response.Write("") end if%>  style="BACKGROUND:#f4f4f4" onClick="EnableSubmit();" >

Open in new window


Option 2
<input type="checkbox" value="chkterm" name="chkterm" id="chkterm" <%If Request.form("chkterm") = "chkterm" Then Response.Write("checked=""checked""") else Response.Write("") end if%>  style="BACKGROUND:#f4f4f4" onClick="EnableSubmit();" >

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question