Copy link to clipboard
Copied
Here is my input tag:
<cfinput type="checkbox" name="checkbox1" id="box1" value="datafrom1" />
<cfinput type="checkbox" name="checkbox2" id="box2" value="datafrom2"/>
<cfinput type="checkbox" name="checkbox3" id="box3" value="datafrom3" />
Action page:
Is checkbox1 checked #IsDefined("form.checkbox1")#
Is checkbox2 checked #IsDefined("form.checkbox2")#
Is checkbox3 checked #IsDefined("form.checkbox3")#
But all says yes whether the checkbox is checked or not.
I know the answer is simple, but I am very new.
The easiest and most basic way to *probably* do what you want to do is to name all your checkbox controls the same.
I.E.
<input type="checkbox" name="myListOfBoxes" value="Blue"/>
<input type="checkbox" name="myListOfBoxes" value="Red"/>
<input type="checkbox" name="myListOfBoxes" value="Green"/>
Then on the action page.
<cfparam name="form.myListOfBoxes" default=""> <!--- Easy way to handle if NO checkboxes are selected --->
<cfoutput>#form.myListOfBoxes#</cfoutput> <!--- Outputs a list of colors sele
...Copy link to clipboard
Copied
Do you have anything else on the actionpage? CFParams for example?
Copy link to clipboard
Copied
yes, it's rather long because there is other data, but yes..should I add this line for each checkbox?
<cfparam name="FORM.checkbox1" default="">
Copy link to clipboard
Copied
if the cfparam for the form is there then it will always be defined.
So instead you can check for the default value vs the checked value.
Copy link to clipboard
Copied
Okay, now I have
<cfparam name="FORM.checkbox1" default="">
for each checkbox.
What should my output tag say?
Copy link to clipboard
Copied
The syntax for outputing form variable is
<cfoutput>#form.something#</cfoutput>
What you should output in your particular case depends on what you are trying to accomplish.
Copy link to clipboard
Copied
Thanks Dan.
I am not a developer, so I'm struggling here:
I simply want to display what checkboxes were checked, sent to me in an email.
This is what I have so far: I receive the information I want except whether any of the various checkboxes were checked.
What do I use to display the checkbox info
<cfmail
from="xxx@dotcom"
to="xxx@dotcom"
subject="Subject Application "
server="">
Name: #Trim(FORM.Name)#
Phone: #Trim(FORM.Phone)#
Email: #Trim(FORM.Email)#
</cfmail>
Copy link to clipboard
Copied
The easiest and most basic way to *probably* do what you want to do is to name all your checkbox controls the same.
I.E.
<input type="checkbox" name="myListOfBoxes" value="Blue"/>
<input type="checkbox" name="myListOfBoxes" value="Red"/>
<input type="checkbox" name="myListOfBoxes" value="Green"/>
Then on the action page.
<cfparam name="form.myListOfBoxes" default=""> <!--- Easy way to handle if NO checkboxes are selected --->
<cfoutput>#form.myListOfBoxes#</cfoutput> <!--- Outputs a list of colors selected, empty if none are checked --->
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you want the actual values:
Action page:
checkbox3 = not checked!
</cfif