The Joke is "on" Me.
-
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?
-
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?
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...
-
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...
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'.
-
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'.
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?
-
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...
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[^]