Check box help

P

Paul M

Hi
I have form which populates itself from an access database which then posts
to an update.asp
In the form there are several checkboxes called charity_cause.
How do I get the check boxes to automatically be ticked when the database
has record called say Animal and wildlife as in the code eg, so if there are
no changes the record updates with the same info as is already in the
database

<input type="checkbox" name="charity_cause" value="Animal and wildlife">

Thanks
Paul M
 
P

p c

You need to use script for that.

Here's an example how to do it using ASP:

<input type="checkbox" NAME="logRecFinal" value="1" <% Call
WriteIfEqual( logRecFinal, TRUE, "CHECKED") %>>

For this example, the sub WriteIfEqual will add "checked" to the input
tag (to check-off the check box) if the value returned from the DB and
assigned to the variable is True. In my example, the possible values are
True or False.

Here's the sub

Sub WriteIfEqual(Val1, Val2, WhatToWrite)
'use for assigning selection for radio/checkbox/Selrct based on previous
'selection
If (Val1 = Val2) Then
Response.write WhatToWrite
End If
End Sub

...PC
 
P

Paul M

Thanks pc
Paul M
p c said:
You need to use script for that.

Here's an example how to do it using ASP:

<input type="checkbox" NAME="logRecFinal" value="1" <% Call
WriteIfEqual( logRecFinal, TRUE, "CHECKED") %>>

For this example, the sub WriteIfEqual will add "checked" to the input tag
(to check-off the check box) if the value returned from the DB and
assigned to the variable is True. In my example, the possible values are
True or False.

Here's the sub

Sub WriteIfEqual(Val1, Val2, WhatToWrite)
'use for assigning selection for radio/checkbox/Selrct based on previous
'selection
If (Val1 = Val2) Then
Response.write WhatToWrite
End If
End Sub

..PC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top