WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Multi-Step Forms
Issue with 'Form value' generated tag (10 posts)

  1. xikky
    Member
    Posted 7 months ago #

    Thanks for such a great plugin dear admin! I'm so glad to see my form sliding from one form to another. :D

    One small problem I am having though is with the 'Form value' generated tag. I am displaying all fields inputted in the last form, before the email is sent. At first it works fine, but if the user refreshes the page, after inputting values and before sending email, the 'Form value' tag will display the previous field values ( and not the new values inputted after refresh). Is there a solution for this please?

    Thank you!

    http://wordpress.org/plugins/contact-form-7-multi-step-module/

  2. xikky
    Member
    Posted 7 months ago #

    I also checked from another remote and this time the form tag never generated the field's text in the summary (last) step

  3. xikky
    Member
    Posted 7 months ago #

    Hi admin, I would like to explain my problem more properly.

    In order to use contact form 7 with multi step in a more stylish way, I have followed how-to-multi-step-slide guide found HERE

    This guide shows how to use your plugin with jQuery. To do so, all steps are loaded into the same page, with only one step being visible to the user. Also when submit (Next), the form will scroll into the next step instead of directing the user into another page.

    I managed to make this work, mailing all needed values from all steps. The only problem was when I wanted to do a 'Summary' step before sending the email. In this step I used [form] to show previous field values.

    This is not working properly, the values do not show in this steps, but I have noticed that on refresh of the page, or after pressing send button to send email and try the form again, the 'Summary' step will show the values of the previous submitted form (and not that of the current).

    I am sure that this can be fixed somehow as the values are stored somewhere (since email received is displaying the right values). Please help me out and show me how to solve this. I'm behind schedule to finish this form and I would really appreciate some help.

    Thank you in advance.

  4. xikky
    Member
    Posted 7 months ago #

    I also hadd to add the following piece of code in my functions.php script, in order to receive values by mail

    add_filter('cf7msm_force_session', '__return_true');
  5. webheadllc
    Member
    Plugin Author

    Posted 7 months ago #

    I think the problem with this is that the form is already printed before the user enters any information. I looked at the blog again and his method will not work with displaying user entered data.

    How it works is the page echoes the cf7 short code when the page loads. Then the user enters their info. When the user clicks on next all the javascript does is animate the already printed forms to show. The forms do not change from when they were first printed.

    You'll need to load the forms via ajax after a user submits a step.

  6. xikky
    Member
    Posted 7 months ago #

    If I understood you well, I need to load the shortcode via ajax. Is this right? and do I have to load it on each Next button? on the last Next button (before summary page) or on Submit (last button)?

    If it's possible to provide information on how to make this work, it will be very appreciated.

  7. webheadllc
    Member
    Plugin Author

    Posted 7 months ago #

    After each Next button ajax needs to load the next step's shortcode. I'm thinking you can call a javascript function in on_sent_ok instead of the animate function. The javascript function would then do an ajax call, get the html and do the animation.

    Another solution could be to not use add_filter('cf7msm_force_session', '__return_true'); so that the plugin uses cookies to store the user's values. Then when on the summary page, use javascript to read the cookie and replace the values on the summary page.

    If all else fails just don't show the summary step if you can.

  8. xikky
    Member
    Posted 7 months ago #

    Thanks for the tips, I'm currently still working on it to make it work. I have encountered a problem though. I have created an ajax call to call the shortcode of the needed form, but instead of returning the renedered html from do_shortcode, the ajax call only returns a string of the shortcode.

    Do you know of any way to fix this? Can't find a possible solution yet, but instead some people say to avoid to call do_shortcode in an ajax call, something which I think I cannot avoid.

  9. xikky
    Member
    Posted 7 months ago #

    I cannot make this to work how it should :( I need more help.

    This is what I am doing now:

    I have created a page for each step and included the respective shortcode in each. Then on every Next button click I call the following jQuery Ajax function...

    jQuery(document).ready(function($) {
    
                $(document).on('click', '.cf7NextBtn', function(e){
                    e.preventDefault();
    
                    var $slider=$('.cf7HideCont').text();
    
                    if ($slider=='PersonalDetails') {
    
                        $.ajax({
                            type:'POST',
                            url:"<?php bloginfo('url') ?>/personal-services/home/get-a-quote/get-a-quote-2-2/",
                            cache: false,
                            dataType: 'html',
                            contentType: 'application/javascript',
    
                            success:function(results) {
                                var $myPos= results.indexOf('<div class="wpcf7" id="wpcf7-f5451-p5549-o1">');
                                var $myHtml= results.substring($myPos);
                                var $myPos= $myHtml.indexOf('</form>');
                                var $myHtml= $myHtml.substring(0, $myPos + 13);
    
                                $('#cf7Slides').html($myHtml);
                            }
                        });
                    }
                    else if ( etc etc ....

    The form steps are replaced fine with the use of Ajax .. but I lost Contact 7 functionality, no validation and no session..

    Please provide me with more details if possible. I am totally lost...

  10. webheadllc
    Member
    Plugin Author

    Posted 7 months ago #

    Sorry this is beyond me. You may want to ask the author of the contact form 7 plugin about how to load the form through ajax.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.