Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. The Joke is "on" Me.

The Joke is "on" Me.

Scheduled Pinned Locked Moved Clever Code
csharpjsonhelpquestion
5 Posts 3 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #1

    So, we do our own XmlHtttpRequest style ajax, to eliminate the baggage the comes with all the libraries, and me in all mine innocence has been sending the .value property of checkboxes to my ajax handler page. I'm very new to this side of the application, so when I got an Invalid String Format exception trying to parse this value into a bool, I inspected it and saw its value was "on". No problem, I'm used to having to code around the very fussy .NET boolean.Parse method, so I construct my own elaborate parsing method, the exception goes away, and I'm happy. Last night. Tonight I notice that an important checkbox on a form isn't updating (the others aren't important yet), and after some time poking around, I see that the value property of a checkbox type input is always "on". WTF does "on" mean when a checkbox is unchecked?

    S 1 Reply Last reply
    0
    • B Brady Kelly

      So, we do our own XmlHtttpRequest style ajax, to eliminate the baggage the comes with all the libraries, and me in all mine innocence has been sending the .value property of checkboxes to my ajax handler page. I'm very new to this side of the application, so when I got an Invalid String Format exception trying to parse this value into a bool, I inspected it and saw its value was "on". No problem, I'm used to having to code around the very fussy .NET boolean.Parse method, so I construct my own elaborate parsing method, the exception goes away, and I'm happy. Last night. Tonight I notice that an important checkbox on a form isn't updating (the others aren't important yet), and after some time poking around, I see that the value property of a checkbox type input is always "on". WTF does "on" mean when a checkbox is unchecked?

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      Brady Kelly wrote:

      WTF does "on" mean when a checkbox is unchecked?

      You wouldn't get it. Before all this DHTML stuff, the normal form posting rules applied: "successful" (in this case, checked) radio buttons send back their values, the rest don't. So, whatever value you assign to the checkbox gets sent back when it's checked and nothing gets sent back when it isn't. Obviously, when you're making up your own request to send back, you can use whatever rules make you happy... So, happy? ;)

      ----

      ...the wind blows over it and it is gone, and its place remembers it no more...

      B C 2 Replies Last reply
      0
      • S Shog9 0

        Brady Kelly wrote:

        WTF does "on" mean when a checkbox is unchecked?

        You wouldn't get it. Before all this DHTML stuff, the normal form posting rules applied: "successful" (in this case, checked) radio buttons send back their values, the rest don't. So, whatever value you assign to the checkbox gets sent back when it's checked and nothing gets sent back when it isn't. Obviously, when you're making up your own request to send back, you can use whatever rules make you happy... So, happy? ;)

        ----

        ...the wind blows over it and it is gone, and its place remembers it no more...

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #3

        Shog9 wrote:

        You wouldn't get it.

        I would and I did, I just didn't get it on my own. Yes, I observed the issue especially when clearing a checkbox, it remained on. I'll be happy when I've gone and fixed changed all my 'value' reads to 'checked'.

        S 1 Reply Last reply
        0
        • B Brady Kelly

          Shog9 wrote:

          You wouldn't get it.

          I would and I did, I just didn't get it on my own. Yes, I observed the issue especially when clearing a checkbox, it remained on. I'll be happy when I've gone and fixed changed all my 'value' reads to 'checked'.

          S Offline
          S Offline
          Shog9 0
          wrote on last edited by
          #4

          Brady Kelly wrote:

          I would and I did,

          Heh, sorry, meant "you" as in, "the server" (wouldn't receive the name/value pair). :)

          every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- Chris Losinger, Online Poker Players?

          1 Reply Last reply
          0
          • S Shog9 0

            Brady Kelly wrote:

            WTF does "on" mean when a checkbox is unchecked?

            You wouldn't get it. Before all this DHTML stuff, the normal form posting rules applied: "successful" (in this case, checked) radio buttons send back their values, the rest don't. So, whatever value you assign to the checkbox gets sent back when it's checked and nothing gets sent back when it isn't. Obviously, when you're making up your own request to send back, you can use whatever rules make you happy... So, happy? ;)

            ----

            ...the wind blows over it and it is gone, and its place remembers it no more...

            C Offline
            C Offline
            Chris Meech
            wrote on last edited by
            #5

            Shog9 wrote:

            nothing gets sent back when it isn't.

            Reminds of the time in the old green screen days, when someone wanted know what the escape sequence was to make the 'spaces' in a field, blink. That was funny. :-D

            Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups