how to implement a check box in classic asp

I have a checkbox

<td><strong>Online Ordering: </strong></td> <td><input type="checkbox" name="OnlineOrdering" value="<%=OnlineOrdering%>" <% if OnlineOrdering = True then response.write "checked='Checked'" end if %>/></td>

How do i capture whether the checkbox is checked or unchecked when form is submitted?

OnlineOrdering = request.form("OnlineOrdering")

this does not work?

-------------Problems Reply------------

This should assign a true/false to the variable OnlineOrdering:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
OnlineOrdering = (Request.Form("OnlineOrdering") <> "")
End If

I found this post because I was trying to solve the same problem. I have a solution that seems to work well.

In the HTML form, create dynamically generated checkboxes. The value of this_box_id used below can be any unique number. In my case it was the primary key (autonumber) for that question from the SQL Database . Dynamically generated the check boxes with an associated hidden field:

<input type="hidden" name="check_box_indicator" value="<%=this_box_id%>">
<input type="checkbox" name="box_id<%=this_email_selection_id%>"

When asp returns the values for this, it will return multiple values for check_box_indicator. Here's a sample query string snippet:


On the next page, ASP will read through the form data. It will find EVERY check_box_indicator and it's value. That value can be used to check the value of the associated checkbox. If that checkbox comes back, it was checked, if it doesn't you will know that it wasn't checked. In the sample above, checkbox 78 was checked and so the box_id78 value was passed, while checkbox 98 was not and box_id98 was not sent. Here's the code to use this.

For Each this_box_id In Request.Form("check_box_indicator") 'check EVERY box'

box_state = Request.Form("box_id"&this_box_id) 'collect passed values only'

if box_state > 0 then
store_value = "y"
store_value = "n"
end if

' you now have the this_box_id number identifying this item in the DB, '
' the value of the check box, if it was passed '
' and a definite y or n value '


With the example querystring, you will get 78 y, 98 n

Category:asp classic Views:0 Time:2012-01-06
Tags: asp classic

Related post

  • howto implement Synchronizer Token Pattern in classic asp 2011-06-21

    to prevent CSRF I want to implement the Synchronizer Token Pattern in my classic asp application. I understand that iIshould generate a token in session_onstart. What I do not get is how to generate such a token as it should be random and unique. So

  • How do I implement a search box in an ASP.NET MVC application? 2011-08-12

    I need to implement a "Search" box on a C# MVC application that I'm writting. I've never had to implement a "Search" box before and I've been looking for some best practices and I'm not quite finding what I'm looking for. I really like how the search

  • Problems deserializing Dictionarys in MVC 3 for AJAX request (an approach that works out of the box with classic ASP.NET Webforms) 2011-07-30

    I've been successfully WebForms for AJAX calls with relatively complex set of parameters (called using jQuery.ajax). We're attempting to try using the same approach in MVC 3 but seem to be falling at the first hurdle with MVC failing to deserialize D

  • implementing CheckBox check in GridView with ASP.NET (C#) 2011-12-23

    Greetigs fellow programmers! I have a question for you about the implementation of a CheckBox check across a Gridview. First of all, the Gridview is binded to a different datasource according to the querystring that links to the page. This is working

  • Iterate through a listView in android to make check boxes visible in front of each item 2011-11-10

    I used the android notepad tutorial code to start with. In my notes_row.xml, I have a textview to display title of note, and a check box that is hidden initially by android:visibility="gone" I want that when the user opens options menu and click on M

  • check box label name from xml 2009-07-30

    I have a check box in an webpage How to fill the labek name of the check box from an xml file ? I did the same for dropdown but i want similar to checkbox xmlData.ReadXml(Server.MapPath("./App_Data/view1_" + txt_dropDownToLoad + ".xml")) Drop

  • How to check all check boxes are checked or not in a ASP.NET gridview 2010-12-03

    How do I find out if all the check boxes in a ASP.NET grid view are checked or not? Depending on this I have to gray out a button. I have to enable the button depending on all check boxes being checked. How do I do this and on which event do I have t

  • Checkbox OnCheckedChanged not fired when JQuery checks check box 2011-05-13

    Thank you for taking the time to read and review my post. I've done a lot of Google searching but have yet to find the answer to my jquery/ question. My issue is I'm trying to replace the standard check box with an on/off image. There is a nea

  • Classic ASP Auto Suggest Like Google 2010-08-21

    While working on a project i came across a functionality in which i need to implement auto suggest textbox using classic asp. I did it and it works fine. I'm using XMLHttp Request object to pick the database column values when user enter something in

  • audit log in classic ASP 2010-11-16

    First let me thank you guys for your amazing work here which have helped me enormously in my work. I was going through the article using which I have developed audit_log in and c# with mysq

  • Include VBscript class inside Classic ASP 2010-12-09

    I'm tring to implement LZW compression inside a classic asp script. this is the LZW VBscript: However, I get into problems (including vb inside classic asp): Microsof

  • A complete image manupulation solution in classical ASP 2010-12-28

    Does anyone have a past experience on implementing a complete image manipulation solution in classical ASP? I need a solution where a user can: Upload an image The uploded image is stored on the filesystem (inside or outside wwwroot) The image is dis

  • if the check box is within a ListView how to implement the OnCheckedChangeListener 2012-02-20

    I succeed to display Phone Contacts in a check Box within a ListView but if i click the button a can't check witch check box is checked this a is the code i work with -----> import java.util.ArrayList; import java.util.HashMap; import

  • How to implement only one check box selected functionality to Chekc box list? 2014-03-19

    How to implement only one check box selected from Check Box list with java script. Here is script: <script language="javascript" type="text/javascript"> var previousCheckId; function toggle(chkBox) { if (chkBox.checked) { if (previousCheckId) {

  • How to implement radion button with check box in one tree in flex 3.0 2010-10-05

    Here is main Application file <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="" layout="absolute" creationComplete="initList()"> <mx:Script> <![CDATA[ import mx.managers.PopUpManager

  • Implementing a Red Cross -Check Box in the Selection Column of the ASPxGridView or general GridView 2011-03-18

    I am currently using DevExpress ASPxGridView and want the selection check box to show a redcross image on selection or empty when unselected. Is there any javascript library to do such a thing. If so can you provide me an example. Pelase make sure th

  • Implementing a wrapping check box list or a tag list in Android 2012-04-09

    A standard list of check boxes takes up a lot of vertical real estate: [ ] Option 1 [X] Opt 2 [X] Loooooong option 3 [ ] Option 4 What I would like to do is either wrap them: [ ] Option 1 [X] Op 2 [X] Loooooong option 3 [ ] Option 4 Or something like

  • How do you go about validating check boxes in ASP.NET MVC? 2008-09-19

    I am wondering what methods people are using for validating check boxes in ASP.NET MVC (both client and server side). I am using JQuery currently for client side validation but I am curious what methods people are using, ideally with the least amount

  • Check Boxes in Rails 2009-03-07

    I am having checkboxes in my html and pagination has also been implemented. when i select few of the check boxes in first page and go to the next page through pagination,It unselects the previous page's check box. and when i click submit it gives me

Copyright (C), All Rights Reserved.

processed in 0.172 (s). 11 q(s)