Submitting checkboxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jaryr

    Submitting checkboxes

    I wonder if there is a way to submit all checkboxes (names and values)
    no mater if they are off or on (checked / unchecked). Anybody would know
    some scripts or tricks to get this working.

    Thanks,
    John R.


  • Bob Lehmann

    #2
    Re: Submitting checkboxes

    If they are not checked, they don't get submitted.

    There are no tips and tricks to get them "working" since they aren't broken.

    What is it you are trying to do?

    Bob Lehmann

    "jaryr" <najyer@hotmail .com> wrote in message
    news:10m8pvaov9 78vfe@corp.supe rnews.com...[color=blue]
    > I wonder if there is a way to submit all checkboxes (names and values)
    > no mater if they are off or on (checked / unchecked). Anybody would know
    > some scripts or tricks to get this working.
    >
    > Thanks,
    > John R.
    >
    >[/color]


    Comment

    • Ray Costanzo [MVP]

      #3
      Re: Submitting checkboxes

      No, the checkbox, by design, will only pass data when it's checked. One
      idea is to use a hidden input that contains your checkbox names, and then
      you can loop through those names to determine if the checkbox was checked or
      not.

      Example:

      <form method="post">
      <input type="checkbox" name="chk1" value="somethin g">
      <input type="checkbox" name="chk2" value="somethin g">
      <input type="checkbox" name="chk3" value="somethin g">
      <input type="hidden" name="checkboxN ames" value="chk1,chk 2,chk3">
      <input type="submit">

      <%
      Dim aNames, i
      aNames = Split(Request.F orm("checkboxNa mes"), ",")
      For i = 0 To UBound(aNames)
      Response.Write "<br>"
      Response.Write "The checkbox named " & aNames(i) & " was checked: " &
      CBool(Request.F orm(aNames(i)) <> "")
      Next
      %>

      Ray at work


      "jaryr" <najyer@hotmail .com> wrote in message
      news:10m8pvaov9 78vfe@corp.supe rnews.com...[color=blue]
      >I wonder if there is a way to submit all checkboxes (names and values)
      > no mater if they are off or on (checked / unchecked). Anybody would know
      > some scripts or tricks to get this working.
      >
      > Thanks,
      > John R.
      >[/color]


      Comment

      • jaryr

        #4
        Re: Submitting checkboxes

        Thank you very much Ray, I was hoping for soluton other
        than using hidden input. Looks like I have no choice.

        Thanks again,
        John R.



        Comment

        • Ray Costanzo [MVP]

          #5
          Re: Submitting checkboxes

          No, there are other choices. It really depends on what you're doing.

          Ray at work


          "jaryr" <najyer@hotmail .com> wrote in message
          news:10m8ug159v gc37d@corp.supe rnews.com...[color=blue]
          > Thank you very much Ray, I was hoping for soluton other
          > than using hidden input. Looks like I have no choice.
          >
          > Thanks again,
          > John R.
          >
          >
          >[/color]


          Comment

          Working...