Support » Plugin: Redirection for Contact Form 7 » Custom error conditional logic not working

  • Resolved matt453654645

    (@matt453654645)


    Hi,

    Im trying to use the conditional logic section in contact for 7 redirection to make a field required sometimes, based on the value of another field.

    I have set up redirection with condition logic and its works perfectly, and although the custom error works, it ignores the conditional logic and always validates the field regardless of what i enter in the conditional logic section.

    My form looks like the below, im trying to get it to only require business-name-pop-up
    if the business tab has been picked.

    Any help would be appreciated, thanks

    <div id=”repair-form” class=”on-pop-up”>
    <script>

    function setRepairFor(){

    var toggle = document.getElementById(‘repair_toggle_pop_up’);
    var input = document.getElementsByName(‘repair-for-pop-up’)[0];
    var business_input = document.getElementsByName(‘business-name-pop-up’)[0];
    var business_postcode = document.getElementsByName(‘business-postcode-pop-up’)[0];
    if(input.value == ‘Home’){
    toggle.children[0].className = ”;
    toggle.children[1].className = ‘on’;
    input.value = ‘Business’;
    business_input.className = ‘ps-custom-input’;
    business_postcode.className = ‘ps-custom-input’;
    }else{
    toggle.children[0].className = ‘on’;
    toggle.children[1].className = ”;
    input.value = ‘Home’;
    business_input.className = ‘ps-custom-input none’;
    business_postcode.className = ‘ps-custom-input none’;
    }

    }
    </script>
    <h4 class=”ps-custom-header”>Get a Repair Estimate</h4>

    <div class=”ps-custom-toggle”>I need a repair for my
    <div class=”toggle” onclick=”setRepairFor()” id=”repair_toggle_pop_up”>
    <div class=”on”>
    Home
    </div>
    <div>
    Business
    </div>
    </div>
    [hidden repair-for-pop-up “Home”]
    </div>
    [text business-name-pop-up class:ps-custom-input class:none placeholder "Business Name"]

    [text business-postcode-pop-up class:ps-custom-input class:none placeholder "Site Postcode"]

    [text* first-name class:ps-custom-input placeholder “First Name”]

    [text* last-name class:ps-custom-input placeholder “Last Name”]

    [email* your-email class:ps-custom-input placeholder “Your Email Address”]

    [tel* your-number class:ps-custom-input placeholder “Contact Phone Number”]

    [textarea* repair-description class:ps-custom-input x4 placeholder “Describe the Repair”]

    [mfile repair-image-pop-up id:multi_file_custom_pop_up class:ps-custom-input]

    [submit class:submit-button-form “Get an Estimate”]

    [response]

    </div>

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.