Radio buttons and checkboxes are the only form elements that
do not have a default value, so the others will always be defined.
<cfif IsDefined ("form.senderPhone") AND
Len(Trim(FORM.senderPhone)) GT 0>
<p>Phone:
<cfoutput>#form.senderPhone#</cfoutput></p>
</cfif>
<cfif IsDefined("form.senderMessage") AND
Len(Trim(FORM.senderMessage)) GT 0>
<p>Message:
<cfoutput>#ParagraphFormat(form.senderMessage)#</cfoutput>
</p>
</cfif>
Probably a more elegant way to do this but I can't think of
it right now.
<cfparam name="FORM.webSiteDesign" default="no">
<cfparam name="FORM.graphicDesign" default="no">
<cfparam name="FORM.logoDesign" default="no">
<cfif FORM.webSiteDesign EQ "yes" OR FORM.graphicDesign EQ
"yes" OR FORM.logoDesign EQ "yes">
<p>
Interested in:<br>
<cfif FORM.webSiteDesign EQ "yes">
webSiteDesign <br>
</cfif>
<cfif FORM.graphicDesign EQ "yes">
graphicDesign<br>
</cfif>
<cfif FORM.logoDesign EQ "yes">
logoDesign<br>
</cfif>
</p>
</cfif>
--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com
"ryansebiz" <ryanjburnett@no-spam-gmail.com> wrote in
message news:eraat2$qrn$1@forums.macromedia.com...
> dempster wrote:
>> Why not use something like <option value="X">
and then test this way:
>>
>> <cfif isdefined("form.referral") AND
form.referral NEQ "X">
>> <cfoutput>#form.senderFirst# heard about you
from #form.referral#</cfoutput>
>> </cfif>
>
> Thanks dempster that worked!
>
> Now I'd like to be able to do the same thing to a phone
text box, a few
> checkboxes and a textarea.
>
> None of the code below works - they all return messages
(i.e. "Phone:"
> "Interested in:" and "Message:") even if that field
isn't filled out.
> I've tried several different variables with no success.
>
> My questions are:
>
> 1. Phone - How can I write the cfif so the "Phone:"
doesn't appear in
> the email if a phone number isn't entered?
>
> 2. Checkboxes - The problem here isn't with the boxes
themselves, but
> with the "Interested in. Currently I have it set to
"WebSiteDesign". The
> obvious problem here occurs when they check another box,
such as
> "GraphicDesign". I've tried OR statements with no
success. How can I
> write a cfif for the exclusion of "Interested in" in the
email if no
> checkboxes are selected?
>
> 3. Textarea - What do I need to change in order for the
email not to
> display "Message:" if no message is entered?
>
> Here's the code:
>
> PHONE
>
> <!---Appears in the email--->
>
> <cfif IsDefined ("form.senderPhone")>
> <p>Phone:
<cfoutput>#form.senderPhone#</cfoutput></p>
> </cfif>
>
> <!---Appears on the page--->
>
> <cfinput type="Text"
> name="senderPhone"
> message="Please enter your area code and phone number."
> mask="999-999-9999"
> validate="telephone"
> validateat="onsubmit,onserver"
> size="30"
> maxlength="16">
>
>
>
>
> CHECKBOXES
>
> <!---Appears in the email--->
>
> <cfif IsDefined("form.webSiteDesign")>
> <p>Interested in:</p>
> </cfif>
>
> <ol>
> <cfif isdefined("form.webSiteDesign")>
> <li>Web site design</li>
> </cfif>
> <cfif isdefined("form.graphicDesign")>
> <li>Graphic design</li>
> </cfif>
> <cfif isdefined("form.logoDesign")>
> <li>Logo design</li>
> </cfif>
> </ol>
>
>
> <!---Appears on the page--->
>
> <p class="boxes">
> <cfinput type="checkbox" name="webSiteDesign"
value="yes">
> Web site design</p>
>
> <p class="boxes">
> <cfinput type="checkbox" name="graphicDesign"
value="yes">
> Graphic design</p>
>
> <p class="boxes">
> <cfinput type="checkbox" name="logoDesign"
value="yes">
> Logo design</p>
>
>
>
>
> TEXTAREA
>
> <!---Appears in the email--->
>
> <cfif IsDefined("form.senderMessage")>
> <p>Message:
>
<cfoutput>#ParagraphFormat(form.senderMessage)#</cfoutput></p>
> </cfif>
>
>
> <!---Appears on the page--->
>
> <textarea name="senderMessage" cols="44" rows="6"
wrap="virtual">
> </textarea>