[thelist] CF: stupid checkbox problem

Michael Buffington mike at price.com
Wed Feb 7 18:19:31 CST 2001


If the checkbox isn't checked, the form.thecheckbox parameter isn't even
passed to your form handler.  Not only is it not null, it doesn't exist.

Ah, the elusive check box puzzle.

Here's the thing about check boxes:

When a form with checkboxes is submitted, and the checkboxes are not
checked, the form.checkbox value doesn't even get passed.  It doesn't exist.

In your form, you have a element named "TheCheckBox".

If that isn't checked, it doesn't get passed.  It seems you've figured this
out, because you're also trying to use:

<CFPARAM name="TheCheckbox" default="No">

Well, you're almost there.  You're "paramming" TheCheckBox to "yes", when
really you should be using this:

<cfparam name="form.TheCheckBox" default="No">

Based on your action code, you're looking for #form.TheCheckBox# without
validating it's existance - you cfparam can help you default it, but you
just need to make sure it's scoped as a form parameter first.

Hope that helps.

Michael Buffington
mike at price.com
(714) 556-3890 x222
http://www.price.com 

-----Original Message-----
From: Erika Meyer [mailto:meyer at up.edu]
Sent: Wednesday, February 07, 2001 2:44 PM
To: thelist at lists.evolt.org
Subject: [thelist] CF: stupid checkbox problem


- The email form:
<input type="checkbox" name="TheCheckbox" value="yes">

- The parameter:
<CFPARAM name="TheCheckbox" default="No">

- The action page:
#FORM.TheCheckbox#

But the form returns an error if any of the checkboxes are not checked.
what is the problem?

Erika


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 




More information about the thelist mailing list