Forums

(Resolved)Hiding empty fields in email notifications v4

rrosko 13 Jul, 2012
I'm struggling with this and was hoping to find some quick assistance.

I've read a number of previous posts on hiding empty fields from displaying on email notifications and I just can't seem to get it to work. I'm using this post in particular to address my situation - http://www.chronoengine.com/forums.html?cont=posts&f=5&t=20922&p=64695&hilit=hide+empty+fields#p64695

I've identified the fields that I want to hide if they are empty and have placed them in a custom code onSubmit action before the email send -

<?php
$payername = JRequest::getString('payername', '', 'post');
JRequest::setVar('payername', $payername);
$payeraddress = JRequest::getString('payeraddress', '', 'post');
JRequest::setVar('payeraddress', $payeraddress);
$payercity = JRequest::getString('payercity', '', 'post');
JRequest::setVar('payercity', $payercity);
$payerzip = JRequest::getString('payerzip', '', 'post');
JRequest::setVar('payerzip', $payerzip);
$payerphone = JRequest::getString('payerphone', '', 'post');
JRequest::setVar('payerphone', $payerphone);
$payerwork = JRequest::getString('payerwork', '', 'post');
JRequest::setVar('payerwork', $payerwork);
$payercell = JRequest::getString('payercell', '', 'post');
JRequest::setVar('payercell', $payercell);
$bankname = JRequest::getString('bankname', '', 'post');
JRequest::setVar('bankname', $bankname);
$checkingacct = JRequest::getString('checkingacct', '', 'post');
JRequest::setVar('checkingacct', $checkingacct);
$routingnum = JRequest::getString('routingnum', '', 'post');
JRequest::setVar('routingnum', $routingnum);
$visa = JRequest::getString('visa', '', 'post');
JRequest::setVar('visa', $visa);
$mastercard = JRequest::getString('mastercard', '', 'post');
JRequest::setVar('mastercard', $mastercard);
$cc_acct = JRequest::getString('cc_acct', '', 'post');
JRequest::setVar('cc_acct', $cc_acct);
$cc_expire = JRequest::getString('cc_expire', '', 'post');
JRequest::setVar('cc_expire', $cc_expire);
$cc_verifynum = JRequest::getString('cc_verifynum', '', 'post');
JRequest::setVar('cc_verifynum', $cc_verifynum);
$cc_name = JRequest::getString('cc_name', '', 'post');
JRequest::setVar('cc_name', $cc_name);
$summertimes2 = JRequest::getString('summertimes2', '', 'post');
JRequest::setVar('summertimes2', $summertimes2);
?>


However, I'm finding that the email form still shows all empty fields in brackets and I'd like to remove them.

Can the fields be required?

Is a custom code action correct for the php?

I thought I was following the threads pretty well, but it's clear I'm doing something wrong...
GreyHead 14 Jul, 2012
Hi rrosko,

The topic heading says CFv4 but the code you have here is for v3. Which version of ChronoForms are you using?

In CFv4 I don't think that you should see the {input_name} entries for empty inputs, there will just be an empty string.

Bob
rrosko 10 Aug, 2012
Sorry for the delay in my response, I didn't have the post set to auto notify...=/

I'm definitely using CF v4 and the code is something I found in the previous links I mentioned, but have since removed and instead I am using the "Handle Arrays" action but without success.

This is a multi-page form and I'm passing all data to the last from successfully, but every-time the form is submitted all empty fields are displayed like this example -


Name - {payername}
Address - {payeraddress}
City - {payercity}
Zip Code - {payerzip}
Home Phone - {payerphone}
Work Phone - {payerwork}
Cell Phone - {payercell}


I just want to remove an empty field from displaying on the email.

I understand that getting rid of the labels is another issue in itself, but nothing I do seems to remove the empty fields that are displayed on any email form submitted.
rrosko 11 Aug, 2012
Hi Bob,

Thanks for your reply, but the FAQ didn't really help and I think I need to ask a better question.

This is a multi-page form with a number of drop-down fields. The drop-downs are what I'm having difficulty with in two respects.

1) The email notices I have setup display all data correctly, except for the drop-down fields. All drop-downs are displayed in the outgoing emails with their curly brackets and not the actual field that was selected in the drop-down, so for this specific drop-down - it doesn't matter what option is selected, I just get the {twohoura} value returned on the email and that happens for every drop-down menu I have on the form, even the drop-downs fields from #2 below.


<select id="twohoura" size="1" class="" title="" name="twohoura">
        <option value="">Select Your First Class/Time</option>
        
    <optgroup label="Preschool Dance " id="preschool-2a" >
        <option value="Preschool Dance Mon 4:30pm ">Mon. 4:30pm | 3-4 yrs. Preschool Dance (Tap, Jazz & Ballet) </option>
        <option value="Preschool Dance Wed 6pm">Wed. 6:00pm  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>
        <option value="Preschool Dance Thur 4pm">Thur. 4:00pm  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>        
        <option value="Preschool Dance Sat 11am">Sat. 11:00am  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>        
    </optgroup>
        
      <optgroup label="Hip Hop" id="hiphop-2a" >
        <option value="Hip Hop 5 to 7 yrs Mon 4:30pm">Mon. 4:30pm  |  5-7 yrs. Hip Hop</option>
        <option value="Hip Hop 8 to 12 yrs Mon 6:30pm">Mon. 6:30pm  |  8-12 yrs. Hip Hop</option>
        <option value="Hip Hop 8 to 12 yrs Tues 5pm"> Tues. 5:00pm  |  8-12 yrs. Hip Hop</option>
        <option value="Hip Hop 5 to 7 yrs Tues 6pm">Tues. 6:00pm  |  5-7 yrs. Hip Hop</option>
        <option value="Hip Hop Teen Tues 7pm">Tues. 7:00pm  |  Teen Hip Hop </option>
        <option value="Hip Hop Competition Wed 5pm">Wed. 5:00pm |  7-12 yrs. Competition Hip Hop</option>
        <option value="Hip Hop lil Dudes Wed 6pm"> Wed. 6:00pm  |  6 & under "Lil Dudes" Hip Hop</option>
        <option value="Hip Hop Competition Big Boyz Wed 7pm">Wed. 7:00pm  |  7 & up Competition "Big Boyz" Hip Hop</option>
      </optgroup>    

      <optgroup label="Ballet" id="ballet-2a" >
        <option value="Ballet A Tues 5pm">Tues. 5:00pm  |   Ballet A</option>
        <option value="Ballet C Tues 6pm">Tues. 6:00pm  |   Ballet C</option>
        <option value="Ballet 1 Thur 5pm">Thur. 5:00pm  |   Ballet 1</option>
        <option value="Ballet B Thur 6pm">Thur. 6:00pm  |   Ballet B</option>
      </optgroup>        

      <optgroup label="Combo (Tap, Jazz and Ballet)" id="combo-2a" >
        <option value="Combo 7 to 8 yrs Mon 6:30pm">Mon. 6:30pm  |   7-8 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo 9 to 11 yrs Mon 7:30pm">Mon. 7:30pm  |   9-11 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo 5 to 7 yrs Tue 5pm">Tues. 5:00pm  |   5-7 yrs. Combo  (Tap, Jazz & Ballet)</option>
        <option value="Combo 5 to 7 yrs Wed 5pm">Wed. 5:00pm  |   5-7 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo 5 to 7 yrs Thur 6pm">Thur. 6:00pm  |   6-7 yrs. Combo (Dance Tap, Jazz & Ballet)</option>
        <option value="Combo 5 to 7 yrs Sat. 9am">Sat. 9:00am  |   5-7 yrs. Combo (Dance Tap, Jazz & Ballet)</option>
      </optgroup>    
        
      <optgroup label="Competition" id="competition-2a" >
        <option value="Competition TapJazz 5 to 6 yrs Mon 5:30pm">Mon. 5:30pm  |   5-6 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition TapJazz 10 to 12 yrs Mon 5:30pm">Mon. 5:30pm  |   10-12 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition TapJazz 6 to 7 yrs Tues 6pm">Tues. 6:00pm  |   6-7 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition TapJazz 9 to 11 yrs Thur 5pm">Thur. 5:00pm  |   9-11 yrs. Competition Tap/Jazz</option>
        <option value="Competition Sr. Jazz Thur 6pm">Thur. 6:00pm  |   Competition Sr. Jazz (Additional Ballet Class Required)</option>
        <option value="Competition Lyrical Thur 7pm">Thur. 7:00pm  |   Competition Lyrical (Additional Ballet Class Required)</option>
        <option value="Competition Sr. Tap Thur 8pm">Thur. 8:00pm  |   Competition Sr. Tap (Additional Ballet Class Required)</option>
        <option value="Competition TapJazz 9 to 11 yrs Sat 10am">Sat. 10:00am  |   7-9 yrs Competition Tap/Jazz (Additional Ballet Class Required)</option>
      </optgroup>    
                
      <optgroup label="All Stars" id="allstars-2a" >
        <option value="All Stars Tues 7pm">Tues. 7:00pm  |   All-Stars (Additional Ballet and Technique Class Required)</option>
        <option value="Jr Technique Thur 4pm">Thur. 4:00pm  |   Jr. Technique</option>
        <option value="Sr. Technique Thur 5pm">Thur. 5:00pm  |   Sr. Technique</option>            
      </optgroup>   
      
</select>  



2) I'm using the Usable Forms 2.0 JS from http://www.quirksmode.org to hide/show form elements via drop-down menus and that works great, but for out-going emails I'm having a small problem.

Any element that remained hidden on the form when it was submitted is still sent via the email and I'd like to remove all traces of fields from the email that were not selected.

I've also attached the forms in their current state, they go in order -

a) studentinfo-2012-13
b) parentinfo-2012-13
c) emergcontactinfo-2012-13
d) paymentinfo-2012-13
e) chooseProgram-2012-13
f) tosconfirm-2012-13


I hope I've described my issues more clearly.
GreyHead 12 Aug, 2012
Hi rrosko,

The HTML looks OK to me. Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Note: if you are using the Easy Wizard you may need to switch to the Advanced Wizard to do this; if you want to continue to use the Easy Wizard please make a copy of your form first and add the Debugger action to the copy.

Please see this FAQ about the missing email values.

Bob
rrosko 12 Aug, 2012
Here is the Debugger output -


Data Array:

Array
(
    [check0] => I AGREE
    [recaptcha_challenge_field] => 03AHJ_VuseIILp0O2mRWZvijchUxWVnjY2YkOwo6V0GDy7MnjvqpXRiiZQLU8O5KuFm9KV1PviZ5ssvhHviTIXHzbSwaqJCmP_XDiAr4X3tJxlHJWZ3hEMUjF_-rhR9xoOUVwLwaWLyHzdZKv_KrJbbLGht8cQ9n0xGA
    [recaptcha_response_field] => clear: ntelste
    [submit] => Next
    [b782610e27781ee71a26c76ec37573ad] => 1
    [option] => com_chronoforms
    [chronoform] => paymentinfo-2012-13
    [event] => submit
    [Itemid] => 
    [firstname] => firstname
    [middleinitial] => a
    [lastname] => lastname
    [age] => 13
    [birthdate] => 5-14-XX
    [telephone] => XXX-XXX-XXXX
    [email] => my email address
    [homeaddress] => 123 Main Street
    [city] => San Francisco
    [zipcode] => 94131
    [mothersname] => mother's name
    [motherphone] => XXX-XXX-XXXX
    [mothercell] => XXX-XXX-XXXX
    [fathersname] => 
    [fatherphone] => 
    [fathercell] => 
    [thepayer] => parent
    [emername] => emergency name
    [emerrelation] => relationship
    [emerphone] => XXX-XXX-XXXX
    [emerwork] => XXX-XXX-XXXX
    [emercell] => XXX-XXX-XXXX
    [payment] => creditcard
    [check_class_number] => 
    [input_radio_0] => 
    [visa] => visa
    [cc_acct] => 1234567898745612
    [cc_expire] => 5/14
    [cc_verifynum] => 123
    [cc_name] => Name as it appears
    [program_long] => 
)

Thank you for Registering firstname with DC Dance!

You should receive an email confirmation regarding your registration. If you have any questions, feel free to reach us via phone at 510-352-2800, or via email at dance1@mac.com

Debug Data

    3
        An email has been SENT successfully from (The DC Dance Website)no-reply@dcdancecenter.com to my email address
        Email template:

        2012 Summer Tuition

        Thanks for filling out our online registration form. The following message shows your information and class selections.
        Student's Information
        Name - firstname a lastname
        Age - 13
        Birthdate - 5-14-XX
        Telephone - XXX-XXX-XXXX
        Email Address - my email address
        Home Address - 123 Main Street
        City - San Francisco
        Zip Code - 94131

        Parent's Information
        Mother's Name - mother's name
        Mother's Phone - XXX-XXX-XXXX
        Mother's Cell - XXX-XXX-XXXX
        Father's Name -
        Father's Phone -
        Father's Cell -

        Person Responsible for Payment

        If the person that filled out the form is not the parent AND will be paying for the child's class, their information will follow

        Name - {payername}
        Address - {payeraddress}
        City - {payercity}
        Zip Code - {payerzip}
        Home Phone - {payerphone}
        Work Phone - {payerwork}
        Cell Phone - {payercell}

        Emergency Contact Information
        Name - emergency name
        Relationship - relationship
        Phone - XXX-XXX-XXXX
        Work Phone - XXX-XXX-XXXX
        Cell - XXX-XXX-XXXX

        Payment Information
        Bank Name - {bankname}
        Checking Account Number - {checkingacct}
        Routing Number - {routingnum}
        Tuition Amount - {tuitionamt}
         
        Credit Card
        visa {mastercard}
        Account Number - 1234567898745612
        Expiration Date - 5/14
        Card Verification ID - 123
        Name as it appears on card - Name as it appears
         

        Program Information

        ONE 1-Hour Class a Week | $62.00 a month {onehour[]}
         

        TWO 1-Hour Classes a Week | $120.00 a month {twohoura[]}

        {twohourb[]}
         

        THREE 1-Hour Classes a Week | $174.00 a month {threehoura[]}

        {threehourb[]}

        {threehourc[]}
         

        FOUR 1-Hour Classes a Week | $216.00 a month {fourhoura[]}

        {fourhourb[]}

        {fourhourc}

        {fourhourd[]}
         

        FIVE 1-Hour Classes a Week | $270.00 a month {fivehoura[]}

        {fivehourb[]}

        {fivehourc[]}

        {fivehourd[]}

        {fivehoure[]}
         

        SIX 1-Hour Classes a Week | $324.00 a month {sixhoura[]}

        {sixhourb[]}

        {sixhourc[]}

        {sixhourd[]}

        {sixhoure[]}

        {sixhourf[]}
         



        Submitted by 24.130.172.23
        Attachments:
        array ( )
    15
        An email has been SENT successfully from (The DC Dance Center Website)no-reply@dcdancecenter.com to my email address
        Email template:

        2012 Summer Tuition

        Thanks for filling out our online registration form. The following message shows your information and class selections.
        Student's Information
        Name - firstname a lastname
        Age - 13
        Birthdate - 5-14-XX
        Telephone - XXX-XXX-XXXX
        Email Address - my email address
        Home Address - 123 Main Street
        City - San Francisco
        Zip Code - 94131

        Parent's Information
        Mother's Name - mother's name
        Mother's Phone - XXX-XXX-XXXX
        Mother's Cell - XXX-XXX-XXXX
        Father's Name -
        Father's Phone -
        Father's Cell -

        Person Responsible for Payment

        If the person that filled out the form is not the parent AND will be paying for the child's class, their information will follow

        Name - {payername}
        Address - {payeraddress}
        City - {payercity}
        Zip Code - {payerzip}
        Home Phone - {payerphone}
        Work Phone - {payerwork}
        Cell Phone - {payercell}

        Emergency Contact Information
        Name - emergency name
        Relationship - relationship
        Phone - XXX-XXX-XXXX
        Work Phone - XXX-XXX-XXXX
        Cell - XXX-XXX-XXXX

        Payment Information
        Bank Name - {bankname}
        Checking Account Number - {checkingacct}
        Routing Number - {routingnum}
        Tuition Amount - {tuitionamt}
         
        Credit Card
        visa {mastercard}
        Account Number - 1234567898745612
        Expiration Date - 5/14
        Card Verification ID - 123
        Name as it appears on card - Name as it appears
         

        Program Information

        ONE 1-Hour Class a Week | $62.00 a month {onehour}
         

        TWO 1-Hour Classes a Week | $120.00 a month {twohoura}

        {twohourb}
         

        THREE 1-Hour Classes a Week | $174.00 a month {threehoura}

        {threehourb}

        {threehourc}
         

        FOUR 1-Hour Classes a Week | $216.00 a month {fourhoura}

        {fourhourb}

        {fourhourc}

        {fourhourd}
         

        FIVE 1-Hour Classes a Week | $270.00 a month {fivehoura}

        {fivehourb}

        {fivehourc}

        {fivehourd}

        {fivehoure}
         

        SIX 1-Hour Classes a Week | $324.00 a month {sixhoura}

        {sixhourb}

        {sixhourc}

        {sixhourd}

        {sixhoure}

        {sixhourf}
         


GreyHead 13 Aug, 2012
Hi rrosko,

Notice that the first email template has {twohoura[]} and the second one has {twohoura}. The second one is correct.

Also none of the select drop-downs appear in the debug output which suggests that something is broken in the Form HTML. A select drop-down always has a value so should always appear in the debug listing.

Bob
rrosko 13 Aug, 2012
Thanks for your assistance Bob - I resolved the issue with certain fields not displaying. The data from the fifth page wasn't being added to the session because of a typo in the session name.

The values for the entire form are now being pulled into my emails, so that is definitely good news but I still want to address the subject of my post - Hiding empty fields in my email notifications.

Since I'm using multiple drop-down select fields on this form, and displaying/hiding some of them based on the users' selection. On the emails that are being sent, I'd like the ability to NOT display the results from fields that weren't selected. Right now, it's just a dump of all the fields.

I saw something in the FAQs about using the "Replace Nulls", but when I view my email's Template box, there is no "Replace Nulls" to select.

Also, one last request - Instead of posting the actual values, I'd like to replace the values with text and I believe I saw a previous post about using a custom code event with some PHP to create an array where I could manually create the 'titles' for each value?

I've posted the last debug that shows all data being submitted -


Data Array:

Array
(
    [check0] => Array
        (
            [0] => I AGREE
        )

    [recaptcha_challenge_field] => 03AHJ_VuuU6z0K5a-Mt_K8wEndYXJzyUVCj7WE9unOm3JGF_d0JXxA3zqaRrD_KcZ4GyG9KIpzjh8JL42N7MeBZ1lQVolt9E7Tav1m-N87aJ_x-9WsVmRfp6RzxWNiskOy-4jtvCm9enKdTtCWzSRWCn1qsM5merePOg
    [recaptcha_response_field] => flocks onerier
    [submit] => Next
    [73d45c620382b149f9887654109091fd] => 1
    [option] => com_chronoforms
    [chronoform] => chooseProgram-2012-13
    [event] => submit
    [Itemid] => 
    [firstname] => firstname
    [middleinitial] => a
    [lastname] => lastname
    [age] => 13
    [birthdate] => 5-14-66
    [telephone] => XXX-XXX-XXXX
    [email] => my email address
    [homeaddress] => 123 Main Street
    [city] => San Francisco
    [zipcode] => 94131
    [mothersname] => mother's name
    [motherphone] => XXX-XXX-XXXX
    [mothercell] => XXX-XXX-XXXX
    [fathersname] => 
    [fatherphone] => 
    [fathercell] => 
    [thepayer] => parent
    [emername] => emergency name
    [emerrelation] => relationship
    [emerphone] => XXX-XXX-XXXX
    [emerwork] => XXX-XXX-XXXX
    [emercell] => XXX-XXX-XXXX
    [payment] => creditcard
    [check_class_number] => 
    [input_radio_0] => 
    [visa] => visa
    [cc_acct] => 1234567898745612
    [cc_expire] => 5/14
    [cc_verifynum] => 123
    [cc_name] => Name as it appears
    [program] => twoclass
    [danceyear2] => 
    [twohoura] => Hiphop2aa
    [danceyear3] => 
    [twohourb] => Hiphop2bh
)

Debug Data

    3
        An email has been SENT successfully from (The DC Dance Website)no-reply@dcdancecenter.com to my email address
        Email template:

        2012-2013 Class Registration

        Thanks for filling out our online registration form. The following message shows your information and class selections.
        Student's Information
        Name - firstname a lastname
        Age - 13
        Birthdate - 5-14-66
        Telephone - XXX-XXX-XXXX
        Email Address - my email address
        Home Address - 123 Main Street
        City - San Francisco
        Zip Code - 94131

        Parent's Information
        Mother's Name - mother's name
        Mother's Phone - XXX-XXX-XXXX
        Mother's Cell - XXX-XXX-XXXX
        Father's Name -
        Father's Phone -
        Father's Cell -

        Person Responsible for Payment

        If the person that filled out the form is not the parent AND will be paying for the child's class, their information will follow

        Name - {payername}
        Address - {payeraddress}
        City - {payercity}
        Zip Code - {payerzip}
        Home Phone - {payerphone}
        Work Phone - {payerwork}
        Cell Phone - {payercell}

        Emergency Contact Information
        Name - emergency name
        Relationship - relationship
        Phone - XXX-XXX-XXXX
        Work Phone - XXX-XXX-XXXX
        Cell - XXX-XXX-XXXX

        Payment Information
        Bank Name - {bankname}
        Checking Account Number - {checkingacct}
        Routing Number - {routingnum}
        Tuition Amount - {tuitionamt}
         
        Credit Card
        visa {mastercard}
        Account Number - 1234567898745612
        Expiration Date - 5/14
        Card Verification ID - 123
        Name as it appears on card - Name as it appears
         

        Program Information
        twoclass

        ONE 1-Hour Class a Week | $62.00 a month

        {onehour}
         

        TWO 1-Hour Classes a Week | $120.00 a month

        Hiphop2aa

        Hiphop2bh
         

        THREE 1-Hour Classes a Week | $174.00 a month

        {threehoura}

        {threehourb}

        {threehourc}
         

        FOUR 1-Hour Classes a Week | $216.00 a month

        {fourhoura}

        {fourhourb}

        {fourhourc}

        {fourhourd}
         

        FIVE 1-Hour Classes a Week | $270.00 a month

        {fivehoura}

        {fivehourb}

        {fivehourc}

        {fivehourd}

        {fivehoure}
         

        SIX 1-Hour Classes a Week | $324.00 a month

        {sixhoura}

        {sixhourb}

        {sixhourc}

        {sixhourd}

        {sixhoure}

        {sixhourf}
         



        Submitted by 24.130.172.23
        Attachments:
        array ( )
    15
        An email has been SENT successfully from (The DC Dance Center Website)no-reply@dcdancecenter.com to my email address
        Email template:

        2012-2013 Class Registration

        Thanks for filling out our online registration form. The following message shows your information and class selections.
        Student's Information
        Name - firstname a lastname
        Age - 13
        Birthdate - 5-14-66
        Telephone - XXX-XXX-XXXX
        Email Address - my email address
        Home Address - 123 Main Street
        City - San Francisco
        Zip Code - 94131

        Parent's Information
        Mother's Name - mother's name
        Mother's Phone - XXX-XXX-XXXX
        Mother's Cell - XXX-XXX-XXXX
        Father's Name -
        Father's Phone -
        Father's Cell -

        Person Responsible for Payment

        If the person that filled out the form is not the parent AND will be paying for the child's class, their information will follow

        Name - {payername}
        Address - {payeraddress}
        City - {payercity}
        Zip Code - {payerzip}
        Home Phone - {payerphone}
        Work Phone - {payerwork}
        Cell Phone - {payercell}

        Emergency Contact Information
        Name - emergency name
        Relationship - relationship
        Phone - XXX-XXX-XXXX
        Work Phone - XXX-XXX-XXXX
        Cell - XXX-XXX-XXXX

        Payment Information
        Bank Name - {bankname}
        Checking Account Number - {checkingacct}
        Routing Number - {routingnum}
        Tuition Amount - {tuitionamt}
         
        Credit Card
        visa {mastercard}
        Account Number - 1234567898745612
        Expiration Date - 5/14
        Card Verification ID - 123
        Name as it appears on card - Name as it appears
         

        Program Information
        twoclass

        ONE 1-Hour Class a Week | $62.00 a month

        {onehour}
         

        TWO 1-Hour Classes a Week | $120.00 a month

        Hiphop2aa

        Hiphop2bh
         

        THREE 1-Hour Classes a Week | $174.00 a month

        {threehoura}

        {threehourb}

        {threehourc}
         

        FOUR 1-Hour Classes a Week | $216.00 a month

        {fourhoura}

        {fourhourb}

        {fourhourc}

        {fourhourd}
         

        FIVE 1-Hour Classes a Week | $270.00 a month

        {fivehoura}

        {fivehourb}

        {fivehourc}

        {fivehourd}

        {fivehoure}
         

        SIX 1-Hour Classes a Week | $324.00 a month

        {sixhoura}

        {sixhourb}

        {sixhourc}

        {sixhourd}

        {sixhoure}

        {sixhourf}
         



        Submitted by 24.130.172.23
        Attachments:
        array ( )


GreyHead 13 Aug, 2012
Hi rrosko,

If you are using the 'Form Wizard' (not the Easy Form Wizard) then the 'Replace Nulls' option is under the template text area. Scroll down to see it.

I'm not sure I understand what you want to do with labels. Can you give me an example?

Bob
rrosko 13 Aug, 2012
Hi Bob,

1) I'm definitely using the Advanced Wizard and you can see that there is no "Replace Nulls" on the Email Template pop-up box. So I can't "hide" any empty fields.

2) If you see in the Debug print-out, near the bottom of the Data Array -


    [program] => twoclass
    [danceyear2] => 
    [twohoura] => Hiphop2aa
    [danceyear3] => 
    [twohourb] => Hiphop2bh


The values selected - Hiphop2aa & Hiphop2bh - I would like to display content that is more descriptive instead of these values.

So I thought I saw a post where I could create some PHP code like below, that would take my field values and assign them custom text, with the net result being a displayed value that actually makes sense to the user. Of course I'd have to include the descriptions and values for every option in all select drop-downs.

<?php
$program_array = array(
  'twohoura' => 'Mon. 4:30pm  |  5-7 yrs. Hip Hop',
  'twohourb' => 'Mon. 6:30pm  |  9-11 yrs. Hip Hop'
);
$programs_long = array();
foreach ( $form->data['program[]'] as $v ) {
  $programs_long[] = $program_array[$v];
}
$form->data['program_long'] = implode("<br>", $program_long);
?>


So instead of Hiphop2aa & Hiphop2bh being displayed in the emails, rather the dates and times of the classes would be displayed instead.
GreyHead 13 Aug, 2012
Hi rrosko,

Hmmm . . . the option is certainly there in the CFv4 RC3.4.1 that I have here.

The code looks OK apart from this line which I don't think matches the data:
foreach ( $form->data['program[]'] as $v ) {
You may nees to add a list/array of the input names that you want to concatenate.

Bob
rrosko 14 Aug, 2012
Hi Bob,

Can you provide a little guidance setting up a form data array?

I've basically got 20 odd drop-down fields and on the outgoing emails generated onSubmit I'd like to display customized results instead of the {values}

I keep seeing the $form->data['input_name'] as an example on the forums but I'm not a big coder and I'm not sure how to integrate a list of values, as opposed to just one value into my forms.


<select id="sixhourf" size="1" class="" title="" name="sixhourf">
        <option value="">Select Your Sixth Class/Time</option>
        
    <optgroup label="Preschool Dance " id="preschool6f" >
        <option value="Preschool6fa">Mon. 4:30pm | 3-4 yrs. Preschool Dance (Tap, Jazz & Ballet) </option>
        <option value="Preschool6fb">Wed. 6:00pm  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>
        <option value="Preschool6fc">Thur. 4:00pm  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>        
        <option value="Preschool6fd">Sat. 11:00am  |   3-4 yrs. Preschool Dance (Dance Tap, Jazz & Ballet)</option>        
    </optgroup>
        
      <optgroup label="Hip Hop" id="hiphop6f" >
        <option value="Hiphop6fa">Mon. 4:30pm  |  5-7 yrs. Hip Hop</option>
        <option value="Hiphop6fb">Mon. 6:30pm  |  8-12 yrs. Hip Hop</option>
        <option value="Hiphop6fc"> Tues. 5:00pm  |  8-12 yrs. Hip Hop</option>
        <option value="Hiphop6fd">Tues. 6:00pm  |  5-7 yrs. Hip Hop</option>
        <option value="Hiphop6fe">Tues. 7:00pm  |  Teen Hip Hop </option>
        <option value="Hiphop6ff">Wed. 5:00pm |  7-12 yrs. Competition Hip Hop</option>
        <option value="Hiphop6fg"> Wed. 6:00pm  |  6 & under "Lil Dudes" Hip Hop</option>
        <option value="Hiphop6fh">Wed. 7:00pm  |  7 & up Competition "Big Boyz" Hip Hop</option>
      </optgroup>    

      <optgroup label="Ballet" id="ballet6f" >
        <option value="Ballet6fa">Tues. 5:00pm  |   Ballet A</option>
        <option value="Ballet6fb">Tues. 6:00pm  |   Ballet C</option>
        <option value="Ballet6fc">Thur. 5:00pm  |   Ballet 1</option>
        <option value="Ballet6fd">Thur. 6:00pm  |   Ballet B</option>
      </optgroup>        

      <optgroup label="Combo (Tap, Jazz & Ballet)" id="combo6f" >
        <option value="Combo6fa">Mon. 6:30pm  |   7-8 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo6fb">Mon. 7:30pm  |   9-11 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo6fc">Tues. 5:00pm  |   5-7 yrs. Combo  (Tap, Jazz & Ballet)</option>
        <option value="Combo6fd">Wed. 5:00pm  |   5-7 yrs. Combo (Tap, Jazz & Ballet)</option>
        <option value="Combo6fe">Thur. 6:00pm  |   6-7 yrs. Combo (Dance Tap, Jazz & Ballet)</option>
        <option value="Combo6ff">Sat. 9:00am  |   5-7 yrs. Combo (Dance Tap, Jazz & Ballet)</option>
      </optgroup>    
        
      <optgroup label="Competition" id="competition6f" >
        <option value="Competition6fa">Mon. 5:30pm  |   5-6 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition6fb">Mon. 5:30pm  |   10-12 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition6fc">Tues. 6:00pm  |   6-7 yrs. Competition Tap/Jazz (Additional Ballet Class Required)</option>
        <option value="Competition6fd">Thur. 5:00pm  |   9-11 yrs. Competition Tap/Jazz</option>
        <option value="Competition6fe">Thur. 6:00pm  |   Competition Sr. Jazz (Additional Ballet Class Required)</option>
        <option value="Competition6ff">Thur. 7:00pm  |   Competition Lyrical (Additional Ballet Class Required)</option>
        <option value="Competition6fh">Thur. 8:00pm  |   Competition Sr. Tap (Additional Ballet Class Required)</option>
        <option value="Competition6fi">Sat. 10:00am  |   7-9 yrs Competition Tap/Jazz (Additional Ballet Class Required)</option>
      </optgroup>    
                
      <optgroup label="All Stars" id="allstars6f" >
        <option value="Allstar6fa">Tues. 7:00pm  |   All-Stars (Additional Ballet and Technique Class Required)</option>
        <option value="Allstar6fb">Thur. 4:00pm  |   Jr. Technique</option>
        <option value="Allstar6fc">Thur. 5:00pm  |   Sr. Technique</option>            
      </optgroup>   
      
</select>  

rrosko 15 Aug, 2012
Hi Bob,

I've basically given my best shot to create an array from other posts I've seen on the forums.

Is my understanding correct that we're defining each value in this array, and for each value - if it's selected from the drop-down, the text in the array will then be inserted into the email in place of the actual value?

I've tried the code below in my form to test and I receive an error on the - foreach ( $form->data['onehour'] as $v ) {

I'm not sure what the "onehour" value should be, and for the purpose of this test I just used the name of my select field.. but apparently I'm doing something wrong...


<?php
$class_array = array(
  'Preschool1a' => 'Mondays 4:30pm, 3-4 yrs. Preschool Dance (Tap, Jazz and Ballet)',
  'Preschool2a' => 'Wednesdays 6:00pm,  3-4 yrs. Preschool Dance (Dance Tap, Jazz and Ballet)',
  'Preschool3a' => 'Thursdays 4:00pm,  3-4 yrs. Preschool Dance (Dance Tap, Jazz and Ballet)',
  'Preschool4a' => 'Saturdays 11:00am,  3-4 yrs. Preschool Dance (Dance Tap, Jazz and Ballet)',
  'Hiphop1a' => 'Mondays 4:30pm, 5-7 yrs. Hip Hop',
  'Hiphop2a' => 'Mondays 6:30pm, 8-12 yrs. Hip Hop',
  'Hiphop3a' => 'Tuesdays 5:00pm, 8-12 yrs. Hip Hop',
  'Hiphop4a' => 'Tuesdays 6:00pm, 5-7 yrs. Hip Hop',
  'Hiphop5a' => 'Tuesdays 7:00pm, Teen Hip Hop',
  'Hiphop6a' => 'Wednesdays 5:00pm,  7-12 yrs. Competition Hip Hop',
  'Hiphop7a' => 'Wednesdays 6:00pm, 6 and under "Lil Dudes" Hip Hop',
  'Hiphop8a' => 'Wednesdays 7:00pm, 7 and up Competition "Big Boyz" Hip Hop',
  'Ballet1a' => 'Tuesdays 5:00pm,  Ballet A',
  'Ballet2a' => 'Tuesdays 6:00pm,  Ballet C',
  'Ballet3a' => 'Thursdays 5:00pm,  Ballet 1',
  'Ballet4a' => 'Thursdays 6:00pm,  Ballet B',
  'Combo1a' => 'Mondays 6:30pm,  7-8 yrs. Combo (Tap, Jazz and Ballet)',
  'Combo2a' => 'Mondays 7:30pm,  9-11 yrs. Combo (Tap, Jazz and Ballet)',
  'Combo3a' => 'Tuesdays 5:00pm,  5-7 yrs. Combo  (Tap, Jazz and Ballet)',
  'Combo4a' => 'Wednesdays 5:00pm,  5-7 yrs. Combo (Tap, Jazz and Ballet)',
  'Combo5a' => 'Thursdays 6:00pm,  6-7 yrs. Combo (Dance Tap, Jazz and Ballet)',
  'Combo6a' => 'Saturdays 9:00am,  5-7 yrs. Combo (Dance Tap, Jazz and Ballet)',
  'Competition1a' => 'Mondays 5:30pm,  5-6 yrs. Competition Tap/Jazz (Additional Ballet Class Required)',
  'Competition2a' => 'Mondays 5:30pm,  10-12 yrs. Competition Tap/Jazz (Additional Ballet Class Required)',
  'Competition3a' => 'Tuesdays 6:00pm,  6-7 yrs. Competition Tap/Jazz (Additional Ballet Class Required)',
  'Competition4a' => 'Thursdays 5:00pm,  9-11 yrs. Competition Tap/Jazz',
  'Competition5a' => 'Thursdays 6:00pm,  Competition Sr. Jazz (Additional Ballet Class Required)',
  'Competition6a' => 'Thursdays 7:00pm,  Competition Lyrical (Additional Ballet Class Required)',
  'Competition7a' => 'Thursdays 8:00pm,  Competition Sr. Tap (Additional Ballet Class Required)',
  'Competition8a' => 'Saturdays 10:00am,  7-9 yrs Competition Tap/Jazz (Additional Ballet Class Required)',
  'Allstar1a' => 'Tuesdays 7:00pm,  All-Stars (Additional Ballet and Technique Class Required)',
  'Allstar2a' => 'Thursdays 4:00pm,  Jr. Technique',
  'Allstar3a' => 'Thursdays 5:00pm,  Sr. Technique '
);
$classes_longone = array();
foreach ( $form->data['onehour'] as $v ) {
  $classes_longone[] = $class_array[$v];
}
$form->data['classes_longone'] = implode("<br>", $classes_longone);
?>
This topic is locked and no more replies can be posted.