473,786 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check Box Problem

On PageA I have:
<Input Type="CheckBox" Name="chkBox" Size="1" Value="True"
checked>

Which works fine!

On PageB I have;
<%If Request("chkBox ")=True Then
Response.Write "True"
Else
Response.Write "False"
End If%>

This is where I am having trouble.

Can I see if the Check Box has been checked in VBScript or
do I have to use Java?, where I am very poor.

This is the fifth time I have submitted this. Either I am
having a difficult time understanding what I have been
instructed or it might be more difficult than people
think. I am not a very good programmer, I am a math
teacher and loved assembler. This object stuff confuses
me.

Thanx in Advance

Tony Zine
Jul 19 '05 #1
3 13706
Both of the following work:

1. In the following, you don't have to test against TRUE:

<%If Request("chkBox ") Then
Response.Write "True"
Else
Response.Write "False"
End If%>
2. This is almost the same as what you had, but since the 'value' for
your checkbox (on your first form) is "True", you need to test against
'True' in quotes. And it is case-sensitive. If your 'value' for the
checkbox was 'itschecked', then 'If Request("chkBox ")="itschecked" '
would also work.

<%If Request("chkBox ")="True" Then
Response.Write "True"
Else
Response.Write "False"
End If%>
I don't have a good explanation at to why your version doesn't work
.... seems like the test should resolve to boolean TRUE, which should
work. Maybe someone else can respond to that.

Terry

On Mon, 15 Dec 2003 19:56:36 -0800, "Tony" <na*****@zianet .com> wrote:
On PageA I have:
<Input Type="CheckBox" Name="chkBox" Size="1" Value="True"
checked>

Which works fine!

On PageB I have;
<%If Request("chkBox ")=True Then
Response.Write "True"
Else
Response.Write "False"
End If%>

This is where I am having trouble.

Can I see if the Check Box has been checked in VBScript or
do I have to use Java?, where I am very poor.

This is the fifth time I have submitted this. Either I am
having a difficult time understanding what I have been
instructed or it might be more difficult than people
think. I am not a very good programmer, I am a math
teacher and loved assembler. This object stuff confuses
me.

Thanx in Advance

Tony Zine


Jul 19 '05 #2
What part of the previous replies don't you understand? In what you have
below, you can know if the user checked the checkbox AFTER THE USER CLICKS
SUBMIT, by using:

<%
If Request.Form("c hkBox") = "True" Then
Response.Write "True"
Else
Response.Write "False"
End If
%>

The value submitted in the form isn't an actual boolean value. It's merely
a string that says "true." You can give your checkbox a value "kajsdf" and
then do:

<% If request.form("c hkBox") = "kajsdf" Then response.write "true" %>

Additionally, if you just want to know if the checkbox was checked, all you
really need to check for is if
Request.form("c hkBox") <> ""

If the checkbox has a value, and the form is submitted with the checkbox
checked, the value of it will NOT be an empty string.
You may wonder what the point of having a checkbox value is then if it can
be anything arbitrary to find out if it was checked, but we can cover the
usefulness in a future post. :]

One last thing: As a math teacher, you should appreciate this, if you have
not yet heard about it.
http://www.foxnews.com/story/0,2933,105383,00.html

It's pretty amazing that a number that large...

Ray at home

"Tony" <na*****@zianet .com> wrote in message
news:14******** *************** ******@phx.gbl. ..
On PageA I have:
<Input Type="CheckBox" Name="chkBox" Size="1" Value="True"
checked>

Which works fine!

On PageB I have;
<%If Request("chkBox ")=True Then
Response.Write "True"
Else
Response.Write "False"
End If%>

This is where I am having trouble.

Can I see if the Check Box has been checked in VBScript or
do I have to use Java?, where I am very poor.

This is the fifth time I have submitted this. Either I am
having a difficult time understanding what I have been
instructed or it might be more difficult than people
think. I am not a very good programmer, I am a math
teacher and loved assembler. This object stuff confuses
me.

Thanx in Advance

Tony Zine

Jul 19 '05 #3
p.s. To further confuse you, you can do this. ;]

Response.Write CBool(Request.F orm("chkBox"))

Ray home

"Ray at <%=sLocation% >" <myFirstNameATl ane34dotKOMM> wrote in message
news:uP******** ******@TK2MSFTN GP12.phx.gbl...
What part of the previous replies don't you understand? In what you have
below, you can know if the user checked the checkbox AFTER THE USER CLICKS
SUBMIT, by using:

<%
If Request.Form("c hkBox") = "True" Then
Response.Write "True"
Else
Response.Write "False"
End If
%>

The value submitted in the form isn't an actual boolean value. It's merely a string that says "true." You can give your checkbox a value "kajsdf" and then do:

<% If request.form("c hkBox") = "kajsdf" Then response.write "true" %>

Additionally, if you just want to know if the checkbox was checked, all you really need to check for is if
Request.form("c hkBox") <> ""

If the checkbox has a value, and the form is submitted with the checkbox
checked, the value of it will NOT be an empty string.
You may wonder what the point of having a checkbox value is then if it can
be anything arbitrary to find out if it was checked, but we can cover the
usefulness in a future post. :]

One last thing: As a math teacher, you should appreciate this, if you have not yet heard about it.
http://www.foxnews.com/story/0,2933,105383,00.html

It's pretty amazing that a number that large...

Ray at home

"Tony" <na*****@zianet .com> wrote in message
news:14******** *************** ******@phx.gbl. ..
On PageA I have:
<Input Type="CheckBox" Name="chkBox" Size="1" Value="True"
checked>

Which works fine!

On PageB I have;
<%If Request("chkBox ")=True Then
Response.Write "True"
Else
Response.Write "False"
End If%>

This is where I am having trouble.

Can I see if the Check Box has been checked in VBScript or
do I have to use Java?, where I am very poor.

This is the fifth time I have submitted this. Either I am
having a difficult time understanding what I have been
instructed or it might be more difficult than people
think. I am not a very good programmer, I am a math
teacher and loved assembler. This object stuff confuses
me.

Thanx in Advance

Tony Zine


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
2768
by: Dave Smithz | last post by:
Hi there, A PHP application I built has a section which lists a number of members to a club whose names each appear with a check box beside them that can be ticked. These check boxes are part of a form which amongst other submit buttons has a one particular submit button that if checked will send the form data (using GET) to a script that will email all the checked members.
8
2482
by: pw | last post by:
Hi, I need to create a function in javascript to check or uncheck all checkboxes in a form. From what I understand, I can do this either by specifying the name of the check box fields such as: function checkAll(list) { var o = document.getElementById(list); var c = o.checked; var f = document.forms.f; var a = f.item(list);
4
4064
by: welie | last post by:
I have a problem canceling a check box update when placing a check in it. Checkbox is not bound. Here is what happens. User clicks a check box. In the BeforeUpdate method of the control, if the check box is being checked, some validation is performed. If the validation fails, I set cancel to true, and the check box is not checked afterwards. This is fine.
6
1959
by: Shannan Casteel via AccessMonster.com | last post by:
I'll explain as well as possible...not an experienced user...but learning. I am working on a database for different kinds of problems with machines. A user will be able to select a problem category from a combo box (i.e. Engine, Fuel, Electrical, Steering, Power Train, Brakes, Hydraulic, Chassis/Structure, etc.). Upon the users selection a series of cooresponding check boxes appears on the form with Problem Subcategories. For instance,...
1
4266
by: scprosportsman | last post by:
Please help guys, i am trying to set up a database here at work and im fairly new to access in terms of writing functions and queries and stuff. I have 2 different places on my design that will require checking a check box to tell which category something will pertain to. Well after each record is entered i want the check to remain with that record and auto clear when going to the next record so i can input something else if i have a...
6
2215
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time and resource consuming Try... Catch, which in iterative processing is totally unacceptable. -tom
12
14539
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
16
5668
by: Brian Tkatch | last post by:
Is there a way to check the order in which SET INTEGRITY needs to be applied? This would be for a script with a dynamic list of TABLEs. B.
1
1420
by: icetalks | last post by:
have a look at this code , its for logging the user in after checking his UserName and Password. dim check as boolean = false ... ... If txtUserName.Text.Length = 0 And txtPass.Text.Length = 0 Then MessageBox.Show("please Enter Your Name and Password") txtUserName.Text = "" txtPass.Text = ""
2
6187
by: Ben | last post by:
Hi! All of a sudden on a newer version of our application a check box on the "Produce Invoice" form cannot be checked. I did not do any changes to this form at all. Below are the things that I know so far about the problem: 1. On the new version of the application the check box cannot be checked 2. On the previous version of the application the check box can be checked 3. I did not do any changes to the form
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.