Support » Plugin: Forminator - Contact Form, Payment Form & Custom Form Builder » Issues with {submission_id} in emails

  • Resolved John

    (@dsl225)


    I’m working on a form that creates simple membership accounts for a club (not related to website user registrations!).

    I’m using this snippet for creating incremental values with an initial value of “1500”.

    I’m also using this snippet for allowing the {submission_id} to be passed on Google Sheets.

    The form is redirecting the user to a another page URL where it displays a confirmation form with the values the user entered at initial form.

    I have 2 issues:

    1 – I cannot find a way to display the Order number created by the first snippet in the confirmation page. Is there a way of using {submission_id} at that page?

    2 – IDs are not displaying correctly in confirmation emails:

    In Forminator, the submissions are shown correctly that way:
    ID: #38-1514
    Order: #1514

    The ID displays first the original submission ID number followed by the one created by the first snippet, while the Order ID displays only the one generated by the snippet, and that’s fine.

    But in confirmation emails I get a strange behavior.
    I’m using the following strings:

    Title of email: New Registration #{submission_id}
    Email message: New Registration #{submission_id}

    and getting this as result despite using exactly the same string at both:

    Title of email: New Registration #1514
    Email message: New Registration #38

    I’m I doing something wrong?

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @dsl225,

    Sorry, I’m a bit lost. It seems like you have another ongoing conversation regarding this in the following ticket, and if I’m not wrong you are looking to cover both your use cases in the snippet shared via the following ticket:
    https://wordpress.org/support/topic/generating-an-incremental-number-upon-submission/#post-13592766

    Could you please confirm if there is any other aspect that isn’t discussed in the above ticket which we should be following in this new thread? If not, it’s better to keep all the conversation in the above ticket to avoid miscommunication.

    Please do advise if I’m missing anything so that we could check further if needed.

    Looking forward to your response. Have a nice day ahead.

    Kind Regards,
    Nithin

    John

    (@dsl225)

    Thanks Nithin, that’s right: Adam replied to the other ticket after I posted this one and I’ll keep the follow-up there as we are heading in the right direction it seems. I posted the above as I had no answer there and was getting strange results with those snippets.

    Sorry about that if it created some confusion.

    But I’m glad you give me the opportunity to raise another question for the same form, but not related to the above questions:

    This form creates a free 1 year membership for a club which has absolutely no relation whatsoever with a website user registration.

    I use a hidden field in order to generate today’s date so that this date outputs at confirmation page and emails as starting date for the 1 year period.

    – Is there a way to calculate an expiration date “registration date+1 year” in those emails, so that we can indicate the validity of those subscriptions?

    Thanks!

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @dsl225

    I hope you are doing well.

    A simple solution would be creating a hidden-field and updating it adding today + 1-year date.

    You can use a JavaScript like this:

    jQuery(document).ready(function(){
    
      jQuery(document).on( 'after.load.forminator', function( form_id ){
    
        // Get today date
        var d = new Date();
        var year = d.getFullYear();
        var month = d.getMonth();
        var day = d.getDate();
        // Today + 1 year
        var c = new Date(year + 1, month, day);
    
        document.querySelector('#forminator-module-1888 #hidden-2').value = c;
    
      } );
    
    });

    Update the #forminator-module-1888 #hidden-2 using your form ID and your hidden field.

    https://monosnap.com/file/vZfyDanufrnuIFx4EfNurSaEcUy9uW

    Most of the theme has the option to add custom JavaScript codes, please, check if your theme has this option too.

    Let us know if you have any further question on this.
    Best Regards
    Patrick Freitas

    John

    (@dsl225)

    Many thanks Patric @wpmudevsupport12,

    That looks awesome!

    I’m using GeneratePress and was able to add this as hook in wp_head but not yet getting it to work. Tested also at wp_footer with same results.

    My registration form has ID 18693 and is using the hidden field “hidden-1” to generate today’s date by using the default value “Date dd/mm/yyyy”.

    This form is redirecting users to a new page where they get a confirmation form displaying the data they entered at submission, plus the date retrieved from the previous date hidden field. This is where I would need to add + 1 year and also at confirmation emails sent to admin and user.

    I added the following code by using the registration’s form data:
    Is this correct?

    <script>
     jQuery(document).on( 'after.load.forminator', function( form_id ){
    
        // Get today date
        var d = new Date();
        var year = d.getFullYear();
        var month = d.getMonth();
        var day = d.getDate();
        // Today + 1 year
        var c = new Date(year + 1, month, day);
    
        document.querySelector('#forminator-module-18693 #hidden-1').value = c;
    
      } );
    
    });
    	</script>
    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @dsl225

    Sorry for the delay here.

    This seems fine

    Is it possible to send the form URL where you added the code and we can check it?

    Best Regards
    Patrick Freitas

    John

    (@dsl225)

    Thanks Patrick @wpmudevsupport12,

    I can send you by email if possible the link and also an admin access.
    The site is still in development at a temporary URL so there is no problem.

    Greetings!

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @dsl225,

    You can use our contact form to provide us with page URL privately but we wouldn’t need admin credentials, and I suggest not sharing these in general:
    https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:

    Subject: “Attn: Patrick Freitas”
    – Link to your WordPress site with the form
    – Link back to this thread for reference
    – Any other relevant urls/info

    Cheers,
    Predrag

    John

    (@dsl225)

    Many thanks Predrag, just did so.

    Cheers.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @dsl225

    Thank you for the information.

    The first line is missing on the script causing the error:

    jQuery(document).ready(function(){

    Can you try to add it?

    Entire code will be:

    jQuery(document).ready(function(){
    
      jQuery(document).on( 'after.load.forminator', function( form_id ){
    
        // Get today date
        var d = new Date();
        var year = d.getFullYear();
        var month = d.getMonth();
        var day = d.getDate();
        // Today + 1 year
        var c = new Date(year + 1, month, day);
    
        document.querySelector('#forminator-module-18693 #hidden-1').value = c;
    
      } );
    
    });

    If it still not working, you can try to add only the vanilla JS using the set time out to make sure form was loaded, something like 5s.

    document.addEventListener("DOMContentLoaded", function () {
      setTimeout(function () {
    
        // Get today date
        var d = new Date();
        var year = d.getFullYear();
        var month = d.getMonth();
        var day = d.getDate();
        // Today + 1 year
        var c = new Date(year + 1, month, day);
    
        document.querySelector('#forminator-module-18693 #hidden-1').value = c;
    
      }, 5000);
    });

    Let us know if you need any further help on this.
    Best Regards
    Patrick Freitas

    Thanks again Patrick @wpmudevsupport12,

    The fist code still didn’t work but the second one works fine indeed!

    That solves my problem, along with the other solution your posted here.

    Your precious assistance in this matter is much appreciated!

    Cheers.

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