By default the form field will only exist if the checkbox is checked, so you could do:
Subscribe to newsletter? <cfoutput>#yesNoFormat(isDefined("form.mailList"))#</cfoutput> As an aside, in the anti-spam and e-mail deliverability communities it is generally considered a bad practice to have these sorts of options checked by default. -Justin On Fri, Jun 28, 2013 at 9:16 AM, Robert Sneed <robertsn...@rhsneed.com> wrote: > > I hope someone can help me with this. I'm kind of stuck on the conditional. > > I have a newsletter signup form that includes a check box that is check by > default. > > <label for="mailList"><input checked="checked" id="mailList" name="mailList" > tabindex="14" type="checkbox" value="0" width="5px" /><span > class="checkbox">I would like to receive your e-newsletter.</span></label> > > I'm trying to email the answer, yes or no, based on whether or not the box is > checked. Here is the conditional code between my <cfmail></cfmail> tags. > > Subscribe to e-newsletter? <cfif isDefined("form.mailList") AND > Len(form.mailList)><cfif NOT > Compare(#form.mailList#,"0")>yes<cfelse>no</cfif></cfif> > > If someone checks the box I get the sentence "Subscribe to e-newsletter? Yes" > in an email. If someone does not check the box I get "Subscribe to > e-newsletter?" I can't figure out how to get the "No" to show up in the email > when the box is not checked. > > I feal like I'm close here but just can't seem to get the "No" answer emailed > when the box is not checked. > > Thanks a lot for your help!! > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356091 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm