• Resolved cpaprotna

    (@cpaprotna)


    As soon as I have more than 3 conditional statements, the conditional tests do not work.

    I have a checkbox with 5 options and I need to show different fields depending on the option.

    Here is the form I am using:

    <div class="tm_pb_contact_form custom-form tm_pb_contact_form_container">
    
    <h2 class="tm_pb_contact_main_title">Testing Form</h2>
    <label for="tm_pb_contact_name" class="tm_pb_contact_form_label">Your Name (required)</label>
        [text* your-name id:tb_pb_contact_name class:tm_pb_contact_form_input] 
    
    <label for="tm_pb_email" class="tm_pb_contact_form_label">Your Email (required)</label>
        [email* your-email id:tm_pb_email class:tm_pb_contact_form_input]
    
    <label for="tm_pb_subject" class="tm_pb_contact_form_label">Subject</label>
        [text your-subject id:tm_pb_subject class:tm_pb_contact_form_input]
    
    <label for="tm_pb_message" class="tm_pb_contact_form_label">Your Message</label>
        [textarea your-message id:tm_pb_message class:tm_pb_contact_form_input]
    
    <label for="radio-yn" class="tm_pb_contact_form_label">Show Group 0</label>
    [radio radio-yn class:tm_pb_contact_form_input label_first use_label_element default:0 "Yes" "No"]
    
    [group group-0]
    <label for="Group0field" class="tm_pb_contact_form_label">Group 0 field</label>
    [text Group0field]
    [/group]
    
    [radio radio-316 class:tm_pb_contact_form_input label_first use_label_element default:1 "group 1" "group 2" "group 3"]
    
    [group group-1]
    <label for="Group1field" class="tm_pb_contact_form_label">Group 1 field</label>
    [text Group1field]
    [/group]
    
    [group group-2]
    <label for="Group2field" class="tm_pb_contact_form_label">Group 2 field</label>
    [text Group2field]
    [/group]
    
    [group group-3]
    <label for="Group3field" class="tm_pb_contact_form_label">Group 3 field</label>
    [text Group3field]
    [/group]
    [mc4wp_checkbox]
    [recaptcha]
    <p>[submit "Send" class:tm_pb_button class:tm_pb_bg_layout_light class:tm_pb_contact_submit]</p>
    
    </div>

    and here is an export of the conditionals that work:

    if [radio-yn] equals "Yes" then show [group-0]
    if [radio-316] equals "group 2" then show [group-2]
    if [radio-316] equals "group 1" then show [group-1]
    

    As I was typing this, I tried something different and found that it starts to fail if you save the form with the conditional tab showing. If you switch back to the Form tab and save, then everything works. I’m not sure how changing the tab effects the output for the form, but it appears after 3 conditionals, saving doesn’t work properly when on the conditional tab

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cpaprotna

    (@cpaprotna)

    My error log has the following in it after doing these tests:

    `[04-Jan-2017 18:33:28 UTC] PHP Strict Standards: call_user_func() expects parameter 1 to be a valid callback, non-static method ContactForm7ConditionalFields::shortcode_handler() should not be called statically in …/wp-content/plugins/contact-form-7/includes/form-tags-manager.php on line 231
    [04-Jan-2017 18:33:28 UTC] PHP Notice: WPCF7_Shortcode is deprecated since Contact Form 7 version 4.6! Use WPCF7_FormTag instead. in …/wp-content/plugins/contact-form-7/includes/functions.php on line 351

    Plugin Author Jules Colle

    (@jules-colle)

    Hey thanks for reporting this. I noticed the problem arises when you only save the form once directly after adding or removing a condition (except if you remove the last one.)

    The fix will be added to the next update.

    I have also removed the PHP Notice. Was unable to reproduce the Strict Standards message though.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘No more than 3 conditional statements’ is closed to new replies.