More Checkboxes

Results 1 to 2 of 2

Thread: More Checkboxes

  1. #1
    Join Date
    Dec 1969

    Default More Checkboxes

    Hi. I am still working on getting the "handle" on Checkboxes. Here is the scenario:<BR>I have a form:<BR>&#060;form action = "SomePage.asp" name = "frmUser" method = "post"&#062;<BR>Within the form I have a checkbox:<BR>&#060;input type=checkbox name = "Something"&#062;Something?&#060;/td&#062;<BR>On the receiving page I have opened a recordset and am performing intake:<BR>objRS("Something") = len(Request.Form("Something"))<BR>This works fine. My question is: How do I test for conditions here? The document that I am refering to gives the following advice. For independent checkboxes (this is indeed an independent checkbox), don&#039;t use the VALUE attribute. Test for NAME = "on" I tried this, but didn&#039;t seem to get a response. I used the code:<BR>If Request.Form("Something") = "on" and, although I didn&#039;t get any error message, I didn&#039;t seem to get what I was driving at either. That&#039;s about it for the moment. Any ideas will be sincerely appreciated. Thanks.

  2. #2
    Join Date
    Dec 1969

    Default Making it too hard...

    The rule is simple: If a checkbox is CHECKED, then the VALUE= of that checkbox is what you get when you do <BR> Request("thatCheckboxName")<BR><BR>If the checkbox is *NOT* checked, then doing<BR> Request("thatCheckboxName")<BR>will give you absolutely nothing.<BR><BR>If you don&#039;t code a VALUE= in your checkbox in the form, then HTML provides a default value for you. But you don&#039;t *really* care what that value is. Just code it the simplest of all ways:<BR><BR> If Request("thatCheckboxName") &#060;&#062; "" Then<BR> Response.Write "You checked thatCheckboxName on the last page"<BR> Else<BR> Response.Write "You did NOT check thatCheckboxName on the last page"<BR> End If <BR> <BR>See also the ASPFAQs, category Databases, General. In particular:<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts