Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter booly66

    (@booly66)

    hi,

    As the filter hook does not work at all, I was able to fix this bug with the following trick:

    1/ I made a hidden text field
    2/ with jQuery, all checkbox values are copied “live” into that field
    3/ when the form is submitted, I have a [text-from-checkboxes] mail tag that works, with a spacing separator ( not the damn comma ??

    jQuery(document).ready(function(){
    	
    	
        jQuery(".ikwens input:checkbox").click(function() {
            var string = "";
            jQuery(".ikwens input:checked").each(function() {
                string = string + ' ' + jQuery(this).val();
            });
            jQuery("input.text-interesse").val(string);
        });
    	
    });
    • This reply was modified 3 years, 8 months ago by booly66.
    • This reply was modified 3 years, 8 months ago by booly66.
    Thread Starter booly66

    (@booly66)

    add_filter( 'wpcf7_mail_tag_replaced_checkbox*',
      function( $replaced, $submitted, $html, $mail_tag ) {
        
          $replaced = implode(' ',$submitted);
        
        return $replaced;
      }, 
      10, 4
    );

    I added this to functions.php, changing the filter, it does not do anything at all ??

    Can you please look at my code, what’s wrong here ?

    • This reply was modified 3 years, 8 months ago by booly66.
    • This reply was modified 3 years, 8 months ago by booly66.
    • This reply was modified 3 years, 8 months ago by booly66.
    Thread Starter booly66

    (@booly66)

    this is the content I have in my Form tab panel.
    Maybe I have to link the “checkboxes mail tag hook” to the checkbox code here ?

    <div class="col-md-6 row"><div class="form-group row">
     <label for="inputEmail3" class="col-md-3 form-control-label">Naam*</label><div class="col-md-9">[text* text-name class:form-control ]</div></div>
    </div>
    <div class="col-md-6"><div class="form-group row">
     <label for="inputEmail3" class="col-md-3 form-control-label">Bedrijf</label><div class="col-md-9">[text text-bedrijf class:form-control "Optioneel"]</div></div>
    </div><div style="clear:both;"></div>
    <div class="col-md-6 row"><div class="form-group row"><label for="inputEmail3" class="col-md-3 form-control-label">E-mail*</label><div class="col-md-9">[email* email-404 class:form-control]</div></div>
    </div>
    <div class="col-md-6 "><div class="form-group row"><label for="inputEmail3" class="col-md-3 form-control-label">Telefoon*</label><div class="col-md-9">[text* tel-915 class:form-control]</div></div>
    </div> <div style="clear:both;"></div>
    <div class="ikwens"><div class=" m-t-30"><p>Ik wens een vrijblijvend gesprek over:</p></div>
    [checkbox* interesse-27 "Totaalrenovatie" "Totaalrenovatie Aanbouw & Opbouw" "Totaalrenovatie Binnenhuis" "Totaalrenovatie Terras & omheining" "Andere"]</div>
    <div style="clear:both;"></div>
    <div class=""><div class="class=" m-t-30""><label for="inputEmail3" class="form-control-label extra-informatie-label">Extra informatie:</label><div>[textarea extrainfo-86 rows:6 class:form-control "Geef hier je bericht in aub"]</div><div style="clear:both;"></div></div></div>
    <div class=""><div class=" m-t-20"><p>Bel mij terug*:</p></div>[checkbox* belme-479 "in de voormiddag" "tijdens de middag" "in de namiddag" "s avonds" ] <div style="clear:both;"></div></div>
    <div class=""><div class="col-md-8 m-t-30" style="padding:0px;"><div class="form-group"><label for="inputEmail3" class="col-md-6 form-control-label last-field">Wanneer wens je de werken aan te vangen*:</label><div class="col-md-6">[text* your-date class:dp-field ]</div></div></div>
    </div>
    <div style="clear:both;"></div>
    <div class=""><div class=" m-t-30"><p>Jouw budget:</p></div>[select* menu-budget  include_blank "<100.000" "100.000 - 200.000" "200.000 - 300.000" ">300.000" "nog niet gekend"] <div style="clear:both;"></div></div>
    <div style="clear:both;"></div>
    <div class=""><div class=" m-t-30"><p>Ik ken Renovatief verbouwen van:</p></div>
    [select menu-referral default:1  "---" "Facebook" "Instagram" "Website" "Youtube" "LinkedIn" "Google of andere zoekmachine" "Vrienden, Familie, Kennissen"] <div style="clear:both;"></div></div>
    <div class="col-md-8 m-t-30" style="padding:0px;"><div class="form-group">[acceptance your-consent] Ik ga akkoord met de <a href="https://www.renovatiefverbouwen.be/privacy-policy.html" target="_blank"><u>privacyverklaring</u></a> </div></div>
    [anr_nocaptcha g-recaptcha-response]
     <div class="col-md-8 m-t-30" style="padding:0px;"><div class="form-group">[submit class:btn class:btn-contactus "verzenden"]</div></div>
    • This reply was modified 3 years, 8 months ago by booly66.
    • This reply was modified 3 years, 8 months ago by booly66.
    Thread Starter booly66

    (@booly66)

    Hi,

    I wrote and tested this code, and it works like a charm ??

    jQuery(window).load(function ()  {
    
    $("form").submit(function(){
       var $input = $(this).find("input.dp-field");
       if (!$input.val()) {
         $input.val("null");
       }
    });
    
    	
    	
    });
    Thread Starter booly66

    (@booly66)

    I would be very grateful for that codesnippet, that I can easily inject in the form page ??

    Thread Starter booly66

    (@booly66)

    a default value null on submit button event would be awesome ! Is this done by simple jQuery ?
    Now, when nothing is filled out, there is nothing output from [my-date] and this can break other systems connected to the form which freak out with an internal server error.

    I’d love to be your guinea pig for this, Fahad ??

    Thread Starter booly66

    (@booly66)

    Thread Starter booly66

    (@booly66)

    add_filter( 'wpcf7_mail_tag_replaced_checkbox',
      function( $replaced, $submitted, $html, $mail_tag ) {
        
          $replaced = implode(' ',$submitted);
        
        return $replaced;
      }, 
      10, 4
    );

    I changed the code as you suggested, to transform the array into one string, but it does not work unfortunately.

    Can you please point me further in the right direction ?
    thanks

    Thread Starter booly66

    (@booly66)

    This code came to me while doing zazen. It’s not correct, the multiple values of [my-checkbox] are still separeted with a comma between them ??

    add_filter( 'wpcf7_mail_tag_replaced_checkbox',
      function( $replaced, $submitted, $html, $mail_tag ) {
        
          $replaced = str_replace(",","",$submitted);
        
        return $replaced;
      }, 
      10, 4
    );
    • This reply was modified 3 years, 8 months ago by booly66.
    • This reply was modified 3 years, 8 months ago by booly66.
    Thread Starter booly66

    (@booly66)

    thank you Fahad
    This is the url: mind-your-business.nu

    The only thing I need:
    when the user does not fill out a date, [my-date] should output null

    So the value null

    How can this be done please ?

    • This reply was modified 3 years, 8 months ago by booly66.
    Thread Starter booly66

    (@booly66)

    hi Takayuki, thank you for your link…

    Unfortunately, from that information I do not have the skills to do this:
    make all checkbox mail tag output display as one string, not separated by comma.

    Can you please show me how to do this ? I am willing to do donation for this help.

    So this
    [my-checkbox]

    Would show as output one string, just separated by space, not comma

    value1 value2 value3

    I use this for an API, and now [my-checkbox] only loads the first value when multiple checkboxes are checked ( the comma is the cause I guess ).

    • This reply was modified 3 years, 8 months ago by booly66.
Viewing 11 replies - 1 through 11 (of 11 total)