Support » Plugin: Conditional Fields for Contact Form 7 » All conditional fied tags appear in email

  • Hello,

    we have an issue where all field tags are being displayed in the email, even thought “Exclude lines with blank mail-tags from output” is checked.

    Use case:

    I have 2 radio buttons that are being displayed, each shows different select dropdown element with its own option elements depending on which radio button is currently selected.

    So if I select “Radio 1”, “Select 1” is being displayed, if I select “Radio 2” then “Select 2 is being displayed”.

    Now if I have Radio 1 selected and Select 1 is being displayed, I choose an option from Select 1, then leave it at that, switch to Radio 2 to show Select 2 and select an option from it, also leave at that.
    Then I send the form, and both values from both Select 1 and 2 are being displayed next to each other.

    Conditional tags export:

    if [radio-543] equals "Radio 1" then show [selgroup1]
    if [radio-543] equals "Radio 2" then show [selgroup2]

    Form code:

    <div class="row">
    <div class="col-xs-12 form-title">
    Registration
    </div>
    </div>
    <div class="row">
    <div class="col-xs-12 col-sm-6">
    <p>[text* your-name placeholder "Your Name"]</p>
    </div>
    <div class="col-xs-12 col-sm-6">
    <p>[text* your-surename placeholder "Your surename"]</p>
    </div>
    </div>
    <div class="row">
    <div class="col-xs-12 col-sm-6">
    <p>[tel* tel-857 placeholder "Your phone"]</p>
    </div>
    <div class="col-xs-12 col-sm-6">
    <p>[email* your-email placeholder "Your email"]</p>
    </div>
    </div>
    <div class="row">
    <div class="col-xs-12">
    <p>[date* date-71 id:regData date-format:Y-m-d min-date:1 max-date:+1Y first-day:1 change-month change-year placeholder "Choose date"]</p>
    </div>
    </div>
    <fieldset>
    <div class="row">
    <div class="col-xs-12">
    [radio radio-543 id:regPasirinkimas2 use_label_element default:1 "Radio 1" "Radio 2"]
    [group selgroup1][select* menu-551 id:selectDropdown1 class:cs-select class:cs-skin-boxes first_as_label "Select 1" "S1 Option 1" "S1 Option 2" "S1 Option 3" "S1 Option 4"][/group][group selgroup2][select* menu-552 id:selectDropdown2 class:cs-select class:cs-skin-boxes first_as_label "Select 2" "optgroup-Group1" "S2G1 Option 1" "S2G1 Option 2" "S2G1 Option 3" "S2G1 Option 4" "endoptgroup" "optgroup-Group2" "S2G2 Option 1" "S2G2 Option 2" "S2G2 Option 3" "endoptgroup" "optgroup-Group3" "S2G3 Option 1" "S2G3 Option 2" "S2G3 Option 3" "endoptgroup"][/group]</div>
    </div>
    </fieldset>
    <div class="row">
    <div class="col-xs-12">
    <p>[textarea textarea-93 placeholder "Papildomi komentarai (galite nurodyti problemą ar užduoti klausimą)"]</p>
    </div>
    </div>
    <div class="row">
    <div class="col-xs-12">
    <p>[submit "Register"]</p>
    </div>
    </div>

    Other plugins I use for the form:
    Contact Form 7 Datepicker
    Contact Form 7 Honeypot

    Other scripts I use for the form:

    Script to form Option Groups in Select (should not affect your plugin):

    $(function(){
      var foundin = $('#selectDropdown2 option:contains("optgroup-")');
      $.each(foundin, function(value){
        var updated = $(this).val().replace('optgroup-','');
        $(this).nextUntil('option:contains("endoptgroup")').wrapAll('<optgroup label="'+updated+'"></optgroup>');
      });
      $('#selectDropdown2 option:contains("optgroup-")').remove();
      $('#selectDropdown2 option:contains("endoptgroup")').remove();
    });

    Script to modify datepicker (should also not affect your plugin):

    jQuery(function($){
    	var holidayDates = [];
    	$("#regData").datepicker({
    		numberOfMonths: 1,
    		beforeShowDay: function(date) {
    			var day = date.getDay(),
    			dm = date.getDate() + "-" + (date.getMonth() + 1);
    			var isHoliday = ($.inArray(dm, holidayDates) != -1);
    				
    			return [day != 0 && !isHoliday];
    	}});
    });

    Overall, I checked your plugin JS file, and you seem to have tested few cases with text inputs, selects and checkboxes, but didn’t find radio buttons, maybe that may be the case?
    I would expect that selecting checkbox/radio button element would clear conditional elements’ value (or an option to do so) or somehow else wouldn’t display conditionally hidden fields’ value.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    Hi, if you don’t mind, could you please set up a configuration with the minimum amount of additional plugins installed where it doesn’t work? I’m have a bit too much work at the moment to look into this, so if you could set up a really simple test case that would be a lot of help to me. Thanks

    Thread Starter Andrius Vlasovas

    (@vlaskiz)

    Anyway I can reach out to you outside this thread where I can PM you details once I set it up?

    Thread Starter Andrius Vlasovas

    (@vlaskiz)

    Considering that you are quite busy and so am I, I just added custom jQuery code to clear selected option depending on which radio button is active and solution works for me, at least for now, and does not show both select elements’ option values in email.
    I have left examples of what seems not to be perfect and you may need to check what’s up with radio buttons, still a really great plugin, good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘All conditional fied tags appear in email’ is closed to new replies.