I dealt with something very similar to this just today, in fact. I've got a
page that I build up a whole MESS of checkboxes, based on a query result. I
create the form names dynamically (a merge of two of the query field names,
for uniqueness). However, being checkboxes, not all of them will pass values
on to the next page.

So what I did, in my loops, was to build a list of the fieldnames as I
created them called "Fieldlist", and pass this on through the form as a
hidden variable.

On the receiving page, I can detect whether a field that was checked
previously has been UNchecked - by the fieldname's presence in "Fieldlist"
and not as a normal form.variable. In that case, I'll update the record and
change the variable in question to 'off' instead of 'on'.

So using that method, you CAN figure out the values of ALL your checkboxes,
whether on or off.

--Scott

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 09, 2000 1:32 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: Checked? Checked="yes"?
> 
> 
> > If you want to pass "yes" to the action page, you should use
> > value="yes" with checked. If you want to pass "5" the following
> > is correct.
> >
> > <CFINPUT TYPE="RADIO" NAME="Part3_2" VALUE="5" CHECKED>?
> 
> This isn't correct. If you want the field to be checked by 
> default, then you
> should add the word CHECKED, as in the above example. If the 
> user submits
> the form with the field checked, the action page will receive 
> the variable
> "Part3_2" with the value "5", not the value "yes".
> 
> > Only fields that are checked will be passed, so on the action
> > page, if you want to check if something has been passed, just
> > check to see if the form field isdefined:
> >
> > <cfif isdefined("form.part3_2")>
> > The field was checked.
> > </cfif>
> 
> If you want to pass any value at all to the action page for a 
> checkbox or
> radio button, the field must be checked when the form is 
> submitted. If the
> field is unchecked, there won't be a corresponding variable 
> in the action
> page.
> 
> However, radio buttons are typically used in groups (or 
> arrays, if you will)
> of fields with the same name and different values. So, as 
> long as one of
> them is checked when the page is loaded, if the user checks 
> another, they
> will uncheck the first one, and there will be a corresponding 
> variable in
> the action page, although it might not correspond with the 
> field that was
> originally checked when the form was first loaded. For 
> example, in the code
> below, the default Stooge is Curly, but no matter what the 
> user does, one
> Stooge will be submitted.
> 
> <INPUT TYPE="radio" NAME="FavoriteStooge" VALUE="Larry"> Larry
> <INPUT TYPE="radio" NAME="FavoriteStooge" VALUE="Moe"> Moe
> <INPUT TYPE="radio" NAME="FavoriteStooge" VALUE="Curly" CHECKED> Curly
> <INPUT TYPE="radio" NAME="FavoriteStooge" VALUE="Shemp"> Shemp
> 
> I hope you find this helpful.
> 
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
> 
> --------------------------------------------------------------
> ----------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/cf_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to