Formatting cfmail: cfifs with no data causing large gap & commas

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Formatting cfmail: cfifs with no data causing large gap & commas

    [url]http://www.desertadfed.com/membershipApp.cfm[/url]
    [url]http://www.desertadfed.com/membershipAppResponse.cfm[/url] (handler)

    Hi, Folks. Can someone help me with these two formatting issues?
    On the above application form, I can't figure out how to fix two things:
    1) See CFMAIL code below. Because data is not present, my cfif is causing a
    huge white gap within the cfmail email.
    2) See CFMAIL code below. Same basic thing results in no space after comma.
    You indicated interest in the following committee(s): Membership,Programs

    Thanks very much for your help!

    Jolayne










    1) Code:
    <cfif Len(Trim(FORM.companyFirstFirstName)) GT 0>Company 1st Name:
    #Trim(FORM.companyFirstFirstName)# #Trim(FORM.companyFirstLastName)#</cfif>
    <cfif Len(Trim(FORM.companyFirstTitle)) GT 0>Company 1st Title:
    #Trim(FORM.companyFirstTitle)#</cfif>
    <cfif Len(Trim(FORM.companyFirstEmail)) GT 0>Company 1st Email:
    #Trim(FORM.companyFirstEmail)#</cfif>
    <cfif Len(Trim(FORM.companySecondFirstName)) GT 0>Company 2nd Name:
    #Trim(FORM.companySecondFirstName)#
    #Trim(FORM.companySecondLastName)#</cfif>
    <cfif Len(Trim(FORM.companySecondTitle)) GT 0>Company 2nd Title:
    #Trim(FORM.companySecondTitle)#</cfif>
    <cfif Len(Trim(FORM.companySecondEmail)) GT 0>Company 2nd Email:
    #Trim(FORM.companySecondEmail)#</cfif>
    <cfif Len(Trim(FORM.companyThirdFirstName)) GT 0>Company 3rd Name:
    #Trim(FORM.companyThirdFirstName)# #Trim(FORM.companyThirdLastName)#</cfif>
    <cfif Len(Trim(FORM.companyThirdTitle)) GT 0>Company 3rd Title:
    #Trim(FORM.companyThirdTitle)#</cfif>
    <cfif Len(Trim(FORM.companyThirdEmail)) GT 0>Company 3rd Email:
    #Trim(FORM.companyThirdEmail)#</cfif>
    <cfif Len(Trim(FORM.companyFourthFirstName)) GT 0>Company 4th Name:
    #Trim(FORM.companyFourthFirstName)#
    #Trim(FORM.companyFourthLastName)#</cfif>
    <cfif Len(Trim(FORM.companyFourthTitle)) GT 0>Company 4th Title:
    #Trim(FORM.companyFourthTitle)#</cfif>
    <cfif Len(Trim(FORM.companyFourthEmail)) GT 0>Company 4th Email:
    #Trim(FORM.companyFourthEmail)#</cfif>
    <cfif Len(Trim(FORM.companyFifthFirstName)) GT 0>Company 5th Name:
    #Trim(FORM.companyFifthFirstName)# #Trim(FORM.companyFifthLastName)#</cfif>
    <cfif Len(Trim(FORM.companyFifthTitle)) GT 0>Company 5th Title:
    #Trim(FORM.companyFifthTitle)#</cfif>
    <cfif Len(Trim(FORM.companyFifthEmail)) GT 0>Company 5th Email:
    #Trim(FORM.companyFifthEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateOneFirstName)) GT 0>Corporate One Name:
    #Trim(FORM.corporateOneFirstName)# #Trim(FORM.corporateOneLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateOneTitle)) GT 0>Corporate One Title:
    #Trim(FORM.corporateOneTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateOneEmail)) GT 0>Corporate One Email:
    #Trim(FORM.corporateOneEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateTwoFirstName)) GT 0>Corporate Two Name:
    #Trim(FORM.corporateTwoFirstName)# #Trim(FORM.corporateTwoLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateTwoTitle)) GT 0>Corporate Two Title:
    #Trim(FORM.corporateTwoTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateTwoEmail)) GT 0>Corporate Two Email:
    #Trim(FORM.corporateTwoEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateThreeFirstName)) GT 0>Corporate Three Name:
    #Trim(FORM.corporateThreeFirstName)#
    #Trim(FORM.corporateThreeLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateThreeTitle)) GT 0>Corporate Three Title:
    #Trim(FORM.corporateThreeTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateThreeEmail)) GT 0>Corporate Three Email:
    #Trim(FORM.corporateThreeEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateFourFirstName)) GT 0>Corporate Four Name:
    #Trim(FORM.corporateFourFirstName)#
    #Trim(FORM.corporateFourLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateFourTitle)) GT 0>Corporate Four Title:
    #Trim(FORM.corporateFourTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateFourEmail)) GT 0>Corporate Four Email:
    #Trim(FORM.corporateFourEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateFiveFirstName)) GT 0>Corporate Five Name:
    #Trim(FORM.corporateFiveFirstName)#
    #Trim(FORM.corporateFiveLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateFiveTitle)) GT 0>Corporate Five Title:
    #Trim(FORM.corporateFiveTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateFiveEmail)) GT 0>Corporate Five Email:
    #Trim(FORM.corporateFiveEmail)#</cfif>
    <cfif Len(Trim(FORM.corporateSixFirstName)) GT 0>Corporate Six Name:
    #Trim(FORM.corporateSixFirstName)# #Trim(FORM.corporateSixLastName)#</cfif>
    <cfif Len(Trim(FORM.corporateSixTitle)) GT 0>Corporate Six Title:
    #Trim(FORM.corporateSixTitle)#</cfif>
    <cfif Len(Trim(FORM.corporateSixEmail)) GT 0>Corporate Six Email:
    #Trim(FORM.corporateSixEmail)#</cfif>

    FINAL MEMBERSHIP SELECTION(S)
    <cfif Len(Trim(FORM.a)) GT 0>Active Membership quantity:
    #Trim(FORM.a)#</cfif>
    <cfif Len(Trim(FORM.b)) GT 0>Associate Membership quantity:
    #Trim(FORM.b)#</cfif>
    <cfif Len(Trim(FORM.c)) GT 0>Non-resident Membership quantity:
    #Trim(FORM.c)#</cfif>
    <cfif Len(Trim(FORM.d)) GT 0>Company 1st Membership quantity:
    #Trim(FORM.d)#</cfif>
    <cfif Len(Trim(FORM.e)) GT 0>Company 2nd Membership quantity:
    #Trim(FORM.e)#</cfif>
    <cfif Len(Trim(FORM.f)) GT 0>Company 3rd-5th Membership quantity:
    #Trim(FORM.f)#</cfif>
    <cfif Len(Trim(FORM.g)) GT 0>Corporate Membership quantity:
    #Trim(FORM.g)#</cfif>
    <cfif Len(Trim(FORM.h)) GT 0>New Member Initiation Fee quantity:
    #Trim(FORM.h)#</cfif>

    TOTAL: #DollarFormat(totalPrice)#

    2) spaces issue code: <cfif Len(Trim(FORM.committeeName)) GT 0>You indicated
    interest in the following committee(s): #Trim(FORM.committeeName)#
    <cfelse>No interest in committees at this time.</cfif>


    Jolayne Guest

  2. Similar Questions and Discussions

    1. Send data from a form through email without using CFMAIL
      Newbie question: I have this form that collects data from input boxes and would like to send that data to an email address. Is there a way to do...
    2. Formatting text output in cfmail
      I have a form that our users can fill out to send an email. The message body is a textarea. The textarea value is passed through a formatting...
    3. CFMAIL and formatting question
      I am using CFMX 7 and CFMAIL to send a 'newsletter' to a bunch of customers. I have all my CSS in the CFML code itself instead of attaching the...
    4. formatting the data in a datagrid
      Hello, I wish to format the data in one of the columns of a datagrid so that it does not display more than 3 decimal places. I have a datagrid...
    5. Printing Commas in Large Number
      I have some very large numnbers EX. 1234567890. I'd like to print the number with commas. EX: 1,234,567,890. I didn't see anything builtin in printf...
  3. #2

    Default Re: Formatting cfmail: cfifs with no data causing largegap & commas

    What I've done is create a variable prior to the cfmail tag that is based on
    all the cfif statements. Then, simply display the variable in cmail
    James74 Guest

  4. #3

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    Hi, James. I'm afraid I'm not quite clear on what you are saying, but I will
    try to figure it out.
    Thank you for your response; I appreciate your time!
    Jolayne
    "James74" <webforumsuser@macromedia.com> wrote in message
    news:d4gcnn$cm7$1@forums.macromedia.com...
    > What I've done is create a variable prior to the cfmail tag that is based
    on
    > all the cfif statements. Then, simply display the variable in cmail

    Jolayne Guest

  5. #4

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    Yo, James:
    Found this cool thing at easyCFM called "<cfsilient>". All I did was
    surround the cfif's with that, and it made the white space go away!
    Thanks again!
    Jolayne
    "Jolayne" <joheinen@NOSPAMheinline.com> wrote in message
    news:d4h0qf$6nn$1@forums.macromedia.com...
    > Hi, James. I'm afraid I'm not quite clear on what you are saying, but I
    will
    > try to figure it out.
    > Thank you for your response; I appreciate your time!
    > Jolayne
    > "James74" <webforumsuser@macromedia.com> wrote in message
    > news:d4gcnn$cm7$1@forums.macromedia.com...
    > > What I've done is create a variable prior to the cfmail tag that is
    based
    > on
    > > all the cfif statements. Then, simply display the variable in cmail
    >
    >

    Jolayne Guest

  6. #5

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    I take that back. The cfsilent actually removes if the data is there
    (greater than 0). Back to the drawing board!
    "Jolayne" <joheinen@NOSPAMheinline.com> wrote in message
    news:d4h52k$bb5$1@forums.macromedia.com...
    > Yo, James:
    > Found this cool thing at easyCFM called "<cfsilient>". All I did was
    > surround the cfif's with that, and it made the white space go away!
    > Thanks again!
    > Jolayne
    > "Jolayne" <joheinen@NOSPAMheinline.com> wrote in message
    > news:d4h0qf$6nn$1@forums.macromedia.com...
    > > Hi, James. I'm afraid I'm not quite clear on what you are saying, but I
    > will
    > > try to figure it out.
    > > Thank you for your response; I appreciate your time!
    > > Jolayne
    > > "James74" <webforumsuser@macromedia.com> wrote in message
    > > news:d4gcnn$cm7$1@forums.macromedia.com...
    > > > What I've done is create a variable prior to the cfmail tag that is
    > based
    > > on
    > > > all the cfif statements. Then, simply display the variable in cmail
    > >
    > >
    >
    >

    Jolayne Guest

  7. #6

    Default Re: Formatting cfmail: cfifs with no data causing largegap & commas

    What James74 was tryign to explain to you was the idea of doing all the cfif
    work before the cfmail and using that to populate a variable with all your text
    and then just output that in the mail.

    It seems to me if you are getting loads of whitespace that you are sending a
    non-HTML email, try setting the type = "HTML" in your cfmail tag. It may help!

    Stressed_Simon Guest

  8. #7

    Default Re: Formatting cfmail: cfifs with no data causing largegap & commas

    Hi Jolayne

    Here's an example:

    Lets say name is required, but email is not:

    Prior to the cfmail tag, create a variable that will hold your text. Let's
    say you want
    to use a table to format your message:

    <cfset mailmsg = '<table>'>
    <cfset mailmsg = variables.mailmsg & '<tr><td>
    Name:</td><td>#form.firstname#</td></tr>'>
    <cfif len(form.email)>
    <cfset mailmsg = variables.mailmsg &
    '<tr><td>Email:</td><td>#form.email#</td></tr>'>
    </cfif>
    <!--- Once you have covered all your variables, end the table --->
    <cfset mailmsg = variables.mailmsg & '</table>'>

    <cfmail>
    #variables.mailmsg#
    </cfmail



    James74 Guest

  9. #8

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    Simon:
    So sorry you are stressed. :)
    Thank you so much for your very clear explanation. It's not quite done, but
    I will let you know after I test it.
    Appreciate your taking the time to reply, Simon.
    Jolayne
    "Stressed_Simon" <webforumsuser@macromedia.com> wrote in message
    news:d4icd1$rsc$1@forums.macromedia.com...
    > What James74 was tryign to explain to you was the idea of doing all the
    cfif
    > work before the cfmail and using that to populate a variable with all your
    text
    > and then just output that in the mail.
    >
    > It seems to me if you are getting loads of whitespace that you are
    sending a
    > non-HTML email, try setting the type = "HTML" in your cfmail tag. It may
    help!
    >

    Jolayne Guest

  10. #9

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    James:
    Thank you very much for your example. I really appreciate it. Am running a
    test, and I will let you know that it works, but I am sure it will from you
    very clear sample. :)
    Jolayne
    "James74" <webforumsuser@macromedia.com> wrote in message
    news:d4j024$pq0$1@forums.macromedia.com...
    > Hi Jolayne
    >
    > Here's an example:
    >
    > Lets say name is required, but email is not:
    >
    > Prior to the cfmail tag, create a variable that will hold your text.
    Let's
    > say you want
    > to use a table to format your message:
    >
    > <cfset mailmsg = '<table>'>
    > <cfset mailmsg = variables.mailmsg & '<tr><td>
    > Name:</td><td>#form.firstname#</td></tr>'>
    > <cfif len(form.email)>
    > <cfset mailmsg = variables.mailmsg &
    > '<tr><td>Email:</td><td>#form.email#</td></tr>'>
    > </cfif>
    > <!--- Once you have covered all your variables, end the table --->
    > <cfset mailmsg = variables.mailmsg & '</table>'>
    >
    > <cfmail>
    > #variables.mailmsg#
    > </cfmail
    >
    >
    >

    Jolayne Guest

  11. #10

    Default Re: Formatting cfmail: cfifs with no data causing large gap & commas

    Hi, Simon and James.
    Very, very intesting. The variables thing worked great, but I didn't use a
    table, so I guessed at <p> and <br> tags, and just need some cleanup.
    The email to me took forever, though, though, any reason for that?
    Thanks so much, I am getting close!
    Jolayne
    "Jolayne" <joheinen@NOSPAMheinline.com> wrote in message
    news:d4petj$h0u$1@forums.macromedia.com...
    > Simon:
    > So sorry you are stressed. :)
    > Thank you so much for your very clear explanation. It's not quite done,
    but
    > I will let you know after I test it.
    > Appreciate your taking the time to reply, Simon.
    > Jolayne
    > "Stressed_Simon" <webforumsuser@macromedia.com> wrote in message
    > news:d4icd1$rsc$1@forums.macromedia.com...
    > > What James74 was tryign to explain to you was the idea of doing all the
    > cfif
    > > work before the cfmail and using that to populate a variable with all
    your
    > text
    > > and then just output that in the mail.
    > >
    > > It seems to me if you are getting loads of whitespace that you are
    > sending a
    > > non-HTML email, try setting the type = "HTML" in your cfmail tag. It may
    > help!
    > >
    >
    >

    Jolayne Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139