Check box help

  • Thread starter Thread starter Paul M
  • Start date Start date
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
 
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
 
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
 
Back
Top