Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Checkbox check


Message #1 by "Philip Palombi" <ppp@h...> on Thu, 18 Jan 2001 18:27:56 -0000
I'm sure this will be obnoxiously simple to answer but being a newbie... I

have a form that has multiple texboxes and checkboxes. I am posting to an

asp page and writing to a SQL database. I get my textbox information in to

the database but not the checkbox stuff. The SQL field for the checkbox is

set to a bit and I am using code that looks like this -

	

	If Request.Form("checkbox5") = True Then

	rstClient("ifp") = 1

	Response.Write"<B>Yup</B>"

	Else 

	Response.Write"<B>Nope</B>"

	End If

I have tried to substitute On and 1 for True with no happy result. How do

I check the textbox value? Any help would be much appreciated.

Philip

Message #2 by Dan Wade <DanW@c...> on Thu, 18 Jan 2001 10:38:31 -0800
I think you need to do:



If Request.Form("checkbox5").checked = True



not sure about the syntax. hope that works



-dan
Message #3 by "Jeffrey Widmer" <jwidmer@o...> on Thu, 18 Jan 2001 13:45:04 -0500
Philip,

What does your form look like?  How you set a value for the checkbox input

fields?  Try something like:

	<INPUT type="checkbox" name="checkbox5" value="chk5selected">



Then when you check for the checkbox use:

	If Request.Form("checkbox5") = "chk5selected" Then....



Hope this helps.

-Jeff



Message #4 by "Philip P. Palombi" <ppp@h...> on Thu, 18 Jan 2001 14:21:36 -0500
Dan,



The True just did not work for me even after I set the checkbox value

property to true.  Maybe if I had set it somewhere in the html?  But all is

good because someone suggested I try on again and  included a bit of code

with on in quotes.  After I adjusted the checkbox value property to on that

worked.  My butt is saved.  Thanks for the response and help -  it's much

appreciated.



Philip

----- Original Message -----

From: "Dan Wade" <DanW@c...>

To: "aspx_beginners" <aspx_beginners@p...>

Sent: Thursday, January 18, 2001 1:38 PM

Subject: [aspx_beginners] RE: Checkbox check





> I think you need to do:

>

> If Request.Form("checkbox5").checked = True

>

> not sure about the syntax. hope that works

>

> -dan




  Return to Index