Time:
Scotland: Sat, 6:47 am
Rhode Island: Sat, 1:47 am
Florida: Sat, 1:47 am
New Mexico: Fri, 11:47 pm
California: Fri, 10:47 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

Selanac Embroidery and Screen Printing

Embroidery
Screen Printing
Signs and Banners
Promotional Advertising

WEBSITE

Contact Paul Canales
TEl: USA 732-901-8417
CELL: USA 732-773-1339


Please click here for more information


For continued disscussion on this topic : Coldfusion multiple checkboxes....


silverfox63
11-17-2001, 01:07 PM
I am processing a form with CF, it has the usual e-mail text fields and a name and message field. Above it however are 22 check boxes that represent some aspect or topic that the viewer is interested in applying for. How do i include any checkbox values checked in the form within the <CFMAIL> tag and do i have to write a <CFIF ISDefined> tag and include an OR statement to take care of all the variables passed across to the form processing page. I have never included checkbox values in form processing before so a big thanks for any help.

regards

silverfox

mmi
11-18-2001, 01:45 AM
hey silverfox - as you might imagine, from my experience Cold Fusion is something that happens to ice cubes in a glass - while you're waiting for a physicist/db'er to answer this, ya might want to scan this search return (http://www.google.com/search?hl=en&q=%22Cold+Fusion%22+checkbox+values+%3CCFMAIL%3E&btnG=Google+Search)

jonsteele
11-18-2001, 07:42 AM
My suggestion would be to name the checkboxes consecutively (i.e. b1, b2, b3, etc.) then loop through them checking the dynamic variable.

<cfset interest="">
<cfloop index="x" from="1" to="#number_of_items#">
<cfset interest="form.i#x#">
<cfparam name="#Evaluate("interest")#" default="null">
<cfif #Evaluate("form.b#x#")# neq "null">
<cfset interest=interest&"#Evaluate("form.b#x#")#">
</cfif>
</cfloop>

silverfox63
11-18-2001, 02:22 PM
Thanks Jon for your help, just one thing, does the looping code that you posted go inside the <CFMAIL> tag itself.


thanks

silverfox

jonsteele
11-18-2001, 04:40 PM
The looping code can go anywhere. It creates an "interest" variable with all the checked checkboxes values. YOu can use this info anyway you want.

Also, you might want to change this line:

<cfset interest=interest&"#Evaluate("form.b#x#")#">

to

<cfset interest=interest&", #Evaluate("form.b#x#")#">

so there is a comma between the values :).

Jon

silverfox63
11-18-2001, 10:02 PM
Hi again jon, many thanks for the previous help, just one more small thing. Once I have the "interest" variable how do i use that inside the <CFMAIL> tag to display which checkbox has been clicked and if they are called b1, b2 etc how will the reciever know which is the name of the item associated with b1 or b2 etc, in this case they relate to furniture types


many thanks

silverfox

jonsteele
11-18-2001, 11:55 PM
For example if you have this:

<input type="check" name="b1" value="Type 1">
<input type="check" name="b2" value="Type 2">
<input type="check" name="b3" value="Type 3">

And the user checks Type 1 and Type 3, the value of the interest variable would be: Type 1, Type 3.

The interest variable has the value attribute of the check input tag.

:) Jon

silverfox63
11-19-2001, 12:07 PM
Hi Jon, I did get the below error for some reason, also, did you mean to put hash marks around ~number_of_items# or do i just put the number of checkboxes to loop thru, in this case 26 with no hash marks around them.

thanks


Lee
--




Error Occurred While Processing Request
Error Diagnostic Information

An error occurred while evaluating the expression:


#Evaluate("form.b#x#")# neq "null"



Error near line 61, column 31.
--------------------------------------------------------------------------------

An error has occurred while processing the expression:

form.b1


Error near line 1, column 1.


--------------------------------------------------------------------------------

Error resolving parameter FORM.B1


The specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.




The error occurred while processing an element with a general identifier of (CFIF), occupying document position (61:2) to (61:42) in the template file C:\Inetpub\wwwroot\contact_brochure_form.cfm.

jonsteele
11-19-2001, 11:07 PM
#numer_of_items# is just a number, so you could put 26 directly in the cfloop tag.

Re the error, I have no idea what the problem is. It even says that form.b1 is a form field. Unless you misspelled it in the form, I have no idea.

You are putting this on the page the form is submitting to, right? :)

Jon