Janine,
I didn't see a sql "query" in your code-example.
The problem you are having appears to be from the difference in behavior
between Checkboxes and input/text boxes.
If you have multiple text-boxes on a page and one of them is blank, that
text box still passes its value (an empty string) to coldfusion. However, a
checkbox works very differently. If you check the checkbox, it passes the
value to coldfusion that you define in your HTML. However, if the checkbox
is NOT checked, NO VALUE IS PASSED TO COLDFUSION, NOT EVEN AN EMPTY STRING.
This is kind of stupid to me, but you just have work around it. In the case
of multiple textboxes, you can name all the textboxes the same name and all
their values will get passed as a big comma-delimited list, even if one item
is missing. However, if you are using check boxes, this won't work.
Instead you will need to name each of the checkboxes something different,
then use a <cfaparam name="Checkbox_1" value="No/false/etc..."> to give them
default values on the receiving page.
So your checkboxes could be something like this:
<input type="CheckBox_1" value="yes" >
<input type="CheckBox_2" value="yes" >
<input type="CheckBox_3" value="yes" >
and on the receiving page:
<cfaparam name="Checkbox_1" value="No">
<cfaparam name="Checkbox_2" value="No">
<cfaparam name="Checkbox_3" value="No">
If you do not want the hardcode every checkbox and every param, you can use
a query from a database to create them and then process them in a loop using
the Evaluate() function. Contact me off list for some example code.
Fregas
[EMAIL PROTECTED]
----- Original Message -----
From: "Janine Jakim" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 2:37 PM
Subject: Update query loop with checkboxes
> I know checkboxes have been discussed many times- I searched the archives
of
> hof and cf support and haven't quite found this issue with them so please
> forgive me if it's been discussed.
> i have a display page that shows about 80 checkboxes- set in a basic table
> format. It looks like so
> English Reading Math Science History
> Visual Aides X X X
>
> Large Print Test X X
>
> Math Aids x
>
> Etc
> I need these checkboxes to update in the database. Problem is using a
loop
> causes errors with the checkboxes. So what I can do with an input box
(ie:
> y/n) using #ListGetAt(Attributes.English, x)#
> Throws an error when there's a blank checkbox. All of my fields have the
> <cfparam>
> So my code works as long as I'm not using a checkbox! (And of course the
> users want checkboxes and they do look better with so much on the page).
> Thanks for any help.
> j
> Below is my query- the error I get is when an empty checkbox is
encountered
>
> An error occurred while evaluating the expression:
> ListFindNoCase("#ListGetAt(Attributes.SOLWriting,x)#")
>
> Error near line 25, column 6.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4