[thelist] CF Radio Buttons Tip

Joshua OIson joshua at alphashop.net
Thu Mar 22 11:51:03 CST 2001


It's always nice to get tips for automating tedious tasks.  Some of the
newer versions of ColdFusion introduced functions and tags that may even
make the tasks easier.  The code you gave could be replaced with the
following:

<!--- list radio button names in a variable --->
<cfset checker = 'one,two,three,four,five,six,seven,eight,nine,ten'>
<!--- loop through them --->
<cfloop index="next" list="#checker#">
  <cfparam name="form.#next#" default="">
</cfloop>

-joshua

----- Original Message -----
From: "matthew garrett" <matthew.garrett at snet.net>
Subject: [thelist] CF Radio Buttons Tip


> <tip type="cf">
> Do you have a form with tons of radio buttons? Here's a simple loop to
> assign values (in the processing page) to any unselected ones. Good for a
> quiz or survey type deal.
>
> <!--- list radio button names in a variable --->
> <cfset checker = 'one,two,three,four,five,six,seven,eight,nine,ten'>
> <!--- loop through them --->
>  <cfloop index="next" list="#checker#">
> <!--- find unselected ones --->
>   <cfif NOT isDefined(Insert(next,'FORM.', 5))>
> <!--- assign default value --->
>    <cfset '#next#' = ' '>
>   </cfif>
>  </cfloop>
>
> </tip>






More information about the thelist mailing list