rant and gripe time - checkboxes

R

richard

It's been a long long time since I did anything with checkboxes.
So I tried searching on the subject and what did I find?
The same damn thing on a few dozen websites.
They all show how the code is to be to have a checkbox.
Not a damn one of them say how to work with that code.
Ok. So you have the checkbox and all the needed information.
Now what?
Somewhere, somehow, some action is required to pass the value contained in
the checkbox to something else.
But none of these sites explain how this is done.

Anyone have a proper site that gives a more complete example of how to
completely implement a checkbox?
 
B

Ben Bacarisse

richard said:
It's been a long long time since I did anything with checkboxes.
So I tried searching on the subject and what did I find?
The same damn thing on a few dozen websites.
They all show how the code is to be to have a checkbox.
Not a damn one of them say how to work with that code.
Ok. So you have the checkbox and all the needed information.
Now what?

The user submits the form, usually by clicking a "submit" button. What
happens after this depends on the "action" and "method" attributes in
of the form in question.
Somewhere, somehow, some action is required to pass the value contained in
the checkbox to something else.
But none of these sites explain how this is done.

It's hard to say much more because it depends on what technology is used
to process the form.
Anyone have a proper site that gives a more complete example of how to
completely implement a checkbox?

If, say, you plan on using a PHP-processed page to handle the form, you
can get good advice in a PHP group, or by searching specifically for
information and PHP and checkbox handling.
 
T

Tim Streater

Ben Bacarisse said:
The user submits the form, usually by clicking a "submit" button. What
happens after this depends on the "action" and "method" attributes in
of the form in question.

Or you can process it using javascript if you feel like it:

<input type="checkbox" onchange="check(this.checked);"> Some text here


and in your javascript:

var manual_check;

function check (checked)
{
manual_check = checked==true ? 1 : 0;
}



But then none of my forms is ever submitted - the user presses a button,
I encode a number of the variables (including manual_check from the
above) into a string and ajax it to the other side.
 
N

Norman Peelman

It's been a long long time since I did anything with checkboxes.
So I tried searching on the subject and what did I find?
The same damn thing on a few dozen websites.
They all show how the code is to be to have a checkbox.
Not a damn one of them say how to work with that code.
Ok. So you have the checkbox and all the needed information.
Now what?
Somewhere, somehow, some action is required to pass the value contained in
the checkbox to something else.
But none of these sites explain how this is done.

Anyone have a proper site that gives a more complete example of how to
completely implement a checkbox?

I half-heartedly assume that you know how to put a checkbox in an
HTML page so you will need to post this question in a newsgroup that
deals with the 'pass the value to something else'. It's the 'working
with that code in something else' that needs to be defined.
 
B

Ben Bacarisse

Tim Streater said:
Or you can process it using javascript if you feel like it:

<input type="checkbox" onchange="check(this.checked);"> Some text here

Yes, but i doubt that the OP wants to write a web app!
and in your javascript:

var manual_check;

function check (checked)
{
manual_check = checked==true ? 1 : 0;
}



But then none of my forms is ever submitted - the user presses a
button, I encode a number of the variables (including manual_check
from the above) into a string and ajax it to the other side.

But then you are probably in control of the user environment. If not,
your forms may well be being submitted (presumably to no effect)!
 
T

Tim Streater

Ben Bacarisse said:
Yes, but i doubt that the OP wants to write a web app!

True but then he's not said what he wants to do.
But then you are probably in control of the user environment. If not,
your forms may well be being submitted (presumably to no effect)!

That happens occasionally, but it's a bug if it does. And it is
immediately apparent, as there is a reload (I only ever write <form>). I
seem to recall reading somewhere that I could, in fact, leave out the
<form></form> altogether.
 
D

Denis McMahon

Anyone have a proper site that gives a more complete example of how to
completely implement a checkbox?

Is it beyond your capability, in such situations, to write your own quick
form with a checkbox which goes to a php script which simply dumps the
$_POST or $_GET array in a <pre></pre> section.

The following html in checkbox.htm:

<html>
<head>
<title>checkboxes</title>
</head>
<body>
<form method="post" action="checkbox.php">
<p>
Post Checkbox:
<input type="checkbox" name="post_checkbox">
<input type="submit" value="Submit Post Checkbox">
</p>
</form>
<form method="get" action="checkbox.php">
<p>
Get Checkbox:
<input type="checkbox" name="get_checkbox">
<input type="submit" value="Submit Get Checkbox">
</p>
</form>
</body>
</html

The following checkbox.php

<html>
<head>
<title>checkboxes</title>
</head>
<body>
<p>Post Data:</p>
<pre>
<?php
var_dump($_POST);
print_r($_POST);
?>
</pre>
<p>Get Data:</p>
<pre>
<?php
var_dump($_GET);
print_r($_GET);
?>
</pre>
</body>
</html
 
D

Denis McMahon

Is it beyond your capability ......

On second thoughts, forget I asked that. It was an absolutely stupid
thing to ask given how widely your lack of capability is recognised.
 
D

dorayme

Denis McMahon said:
On second thoughts, forget I asked that. It was an absolutely stupid
thing to ask given how widely your lack of capability is recognised.

Perhaps you might consider a third thought, that it was completely and
*unnecessarily* rude.
 
T

Tim Streater

dorayme said:
Perhaps you might consider a third thought, that it was completely and
*unnecessarily* rude.

Well I'm not sure of that. Sometimes its *necessary* to be rude in order
to get a message through. And Dennis's post wasn't even that rude.
 
B

Ben Bacarisse

Tim Streater said:
Well I'm not sure of that. Sometimes its *necessary* to be rude in
order to get a message through. And Dennis's post wasn't even that
rude.

I think you need to re-calibrate your notion of rude. But from a purely
pragmatic point of view, how has the policy of being rude when necessary
been working out? Have you managed to get the message through to anyone
by doing that? As an observer of other people using that policy, it
does not seem to work very well.
 
T

Tim Streater

dorayme said:
OK, for what it's worth, it could have been ruder!

It could have been considerably ruder. I'd call it a little sharp, but
no worse than that.
But that means
little because things can almost always be worse than they are.
Really, when has any level of rudeness ever had any *desired* effect
on the OP before? Seems sad that you think there is a message that
cannot be packaged a little better, the OP was just asking some
questions.

The OP appears to have difficulty even formulating questions. There was
no indication of what he wanted to do other than "to completely
implement a checkbox", whatever that may mean.

I chipped in with some info about doing some processing in the browser,
and Denis with an example involving form submission. None of this caused
the OP to amplify his original request in any way at all. Small wonder,
to my mind, that Denis got fed up. You'll note that the OP has form in
this regard.
 
L

Lewis

In message said:
It's been a long long time since I did anything with checkboxes.
So I tried searching on the subject and what did I find?
The same damn thing on a few dozen websites.
They all show how the code is to be to have a checkbox.
Not a damn one of them say how to work with that code.
Ok. So you have the checkbox and all the needed information.
Now what?

You need a script to accept the submission of the form with the
checkbox(es). This can either be live on the page, or based on a submit
button.
Somewhere, somehow, some action is required to pass the value contained in
the checkbox to something else.

Yes, and that is outside the scope of HTML. You use HTML to create the
page, including checkboxes. Something else has to process the input.
 
L

Lewis

In message said:
OK, for what it's worth, it could have been ruder! But that means
little because things can almost always be worse than they are.
Really, when has any level of rudeness ever had any *desired* effect
on the OP before? Seems sad that you think there is a message that
cannot be packaged a little better, the OP was just asking some
questions.

First: Nothing anyone has ever said in this group seems to have had the
slightest effect on richard.

Second: this is classic richard, ask a question that shows a (remarkable)
lack of knowledge from someone who's supposedly been doing this
for years. Next up, he'll start arguing about the answers.

Third: Have you *met* richard.

--
perfectly ordinary books, printed on commonplace paper in mundane ink.
It would be a mistake to think that they weren't also dangerous, just
because reading them didn't make fireworks go off in the sky. Reading
them sometimes did the more dangerous trick of making fireworks go off
in the privacy of the reader's brain. --Soul Music
 
D

dorayme

Lewis said:
First: Nothing anyone has ever said in this group seems to have had the
slightest effect on richard.

This is not quite true, but lets not worry about it. Why bother to
even reply to OP, much less be rude to him if this is such a well
known fact? Rudeness has an honourable place in life, literature and
art generally, just it seems that this card was played inappropriately
early in the thread, there needs to be a better excuse. A little more
connoisseurship in this matter is needed. said:
Second: this is classic richard, ask a question that shows a (remarkable)
lack of knowledge from someone who's supposedly been doing this
for years. Next up, he'll start arguing about the answers.

So, you are saying what? That it is understandable that someone should
offer some helpful information with one hand while delivering a
precautionary said:
Third: Have you *met* richard.

Yes.
 
R

richard

You need a script to accept the submission of the form with the
checkbox(es). This can either be live on the page, or based on a submit
button.


Yes, and that is outside the scope of HTML. You use HTML to create the
page, including checkboxes. Something else has to process the input.

So what is the point of discussing how to code the stuff without showing
how to use it in real life?
You put a hundred checkboxes on a page. Somebody checks them all and
nothing happens. So what's the point of having the?
 
R

richard

This is not quite true, but lets not worry about it. Why bother to
even reply to OP, much less be rude to him if this is such a well
known fact? Rudeness has an honourable place in life, literature and
art generally, just it seems that this card was played inappropriately
early in the thread, there needs to be a better excuse. A little more


So, you are saying what? That it is understandable that someone should
offer some helpful information with one hand while delivering a


Yes.

Interesting comments.
In this issue, which I did mark as a rant, I was looking at why people go
to all the trouble about writing a lesson on how to do somethijng, then not
follow up with at least an example.

As you have been around a long time, you know that when I repost a question
about something, do I not generally say something like I need a refersher?

Just curious.
#3 answer says we have met. Physically? When and where?
There is only one person in my entire life that I have known personally
from your neck of the woods and she lives in new zealand.
 
T

Tim Streater

richard said:
So what is the point of discussing how to code the stuff without showing
how to use it in real life?
You put a hundred checkboxes on a page. Somebody checks them all and
nothing happens. So what's the point of having the?

You haven't said what it is you want to do. I posted something and so
did, IIRC, Denis. You've not commented on either offering.

You remind me of a bloke who used some of our group's stuff when I was
working at CERN. He'd come into our office from time to time and say "It
doesn't work". My response was to look concerned and say "Have you been
to the Doctor about it?" He soon learnt that issues get resolved a lot
quicker when he gave rather more information about what "didn't work". I
suggest you do the same.

F'rinstance, you say above "Somebody checks them all and nothing
happens". Well, what were you expecting to happen? Your screen to go
blank? Some part of the web page to change? The power to go off two
blocks down the road? The ICBM in the silo across the street to launch
and take out Las Vegas?
 
J

Jonathan N. Little

Tim said:
You haven't said what it is you want to do. I posted something and so
did, IIRC, Denis. You've not commented on either offering.

You remind me of a bloke who used some of our group's stuff when I was
working at CERN. He'd come into our office from time to time and say "It
doesn't work". My response was to look concerned and say "Have you been
to the Doctor about it?" He soon learnt that issues get resolved a lot
quicker when he gave rather more information about what "didn't work". I
suggest you do the same.

F'rinstance, you say above "Somebody checks them all and nothing
happens". Well, what were you expecting to happen? Your screen to go
blank? Some part of the web page to change? The power to go off two
blocks down the road? The ICBM in the silo across the street to launch
and take out Las Vegas?

If it is something other than all the checkbox controls have a tick mark
indicator then he does not understand the purpose of the control, i.e.,
a checkbox should not submit a form...
 
C

Christoph Michael Becker

richard said:
So what is the point of discussing how to code the stuff without showing
how to use it in real life?

As others have already pointed out in this thread, there are many ways
to "use" checkboxes (i.e. processing them). They can be processed by
browser side scripting, or, after submitting a form, by a server side
script. If you're looking for the latter, you may consider to ask in a
newsgroup which deals with the respective programming language (e.g.
comp.lang.php for PHP). An alternative is to search the web, e.g. for
"php processing checkboxes".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top