The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Showing Calculation Result On a New Page

Labels

This Discussion is public

Notifications

I have a multistep form that performs a calculation.  I would like to track the number of people who complete this form, so I need the results/calculation to be displayed on a separate "Thank you" page.

Right now I've tried doing this using the shortcode [frm-field-value field_id=93 user_id=current]

This only works for one calculation but then it keep showing the same result regardless of the values being chosen.  Any ideas?

The user_id=current in the shortcode will always bring back the most recently submitted answer for that user. What happens if you remove that parameter?

The calculation works the first time, but if I go back to the form and submit it again, it always shows the same result.  I tried removing the parameter, using IP=1, but still have the same issue.  Not sure if it's a caching issue.

I want non-logged in users to be able to use the calculator.  Here's the link to the page.

https://www.adstash.com/revenue-calculator/

Provide a screenshot of your form settings.

Attached.


Attachments:

Are you using a view for the results on the "your-revenue-score"?

No I just entered the shortcode on the page to display the results.  Should I be creating a view for this?  Never really used views before so not sure how it would work.

Add ?entry-id=[ID] to your redirect URL. On the page that shows the results change the shortcode to [frm-field-value field_id=93  entry="entry-id"]. Let me know if that fixes it.

That did not work either, still having the same problem.  I added the ?entry-id=[ID] after the slash on the URL.

Also, for "entry-id" am I entering any specific value?  I just added everything the way you have it above.

It should work as I've instructed. Is the entry saved from the form based on entry ID? Can you export the form for my testing purposes?

Honestly I'm not sure how the entry is being saved.  But I did attach the form for you to test out.

I don't see an attachment.

sorry not sure why the attachment didn't go through.  You can download it from the link below.
https://sprend.com/download.htm?C=d05965d8e4c34eae8d9162228cef9b54

Ah yes. The reason is because the entry id is not saved until after the form submits. The entry is then unable to be retrieved for the redirect.

This will take some tweaking on our own. Does the result have to be on a different page or can we stay on the calculator page and change the message of the form on completion?

hmmm, that's how I had it before but the point of having it on a separate page is that I'd like to track form completions using Google Analytics.  To do that, I need a "thank you" page where people land, indicating that they've completed the form.

If I simply show a message on the same page then I'd have no way of tracking form conversions.

I've decided we can just use javascript to delay the redirect, thus capturing the entry ID.

Change your "On Submit" setting to "Show Message", then add something like this:

<script>
jQuery('.entry-content').html('<center>Your savings are being calculated....</br><img src="<animated loading gif url here>" style="max-height:100px;"></center>');
setTimeout(function () {
window.location.href = "<siteurl here>/revenue-calculator/savings/?entry-id=[id]';
}, 3000);
</script>

That didn't work.  It does not redirect and the form turns blank.  Then if I try to refresh it says "You've already submitted this form."

The exact script I used:

<script>
jQuery('.entry-content').html('<center>Your savings are being calculated....</br><img src="https://www.adstash.com/wp-content/uploads/2018/10/spinner.gif" style="max-height:100px;"></center>');
setTimeout(function () {
window.location.href="https://www.adstash.com/your-revenue-score/?entry-id=[id]';
}, 3000);
</script>

You have 3 errors on the page. At least one of those is a js error. Open your browser and press f12 to check the error and get it corrected.

Also change ".entry-content" in the first line to ".thrv_wrapper" for your theme.

Still no luck, still get the jquery is not defined error even after changing to .thrv_wrapper and correcting the previous error.

 

It does work, so you need to look over your whole application.

I've got it working in some capacity here: https://www.techmavenconsulting.com/dev/revenue-calculator/

Very strange, does the redirect URL have to include original URL?  In your case the URL is /revenue-calculator/savings

Does it have to be that way or will any URL work?

I'll keep messing around with it and see if I come up with something that works

Thanks for your help by the way I really appreciate you taking the time.

I don't believe that matters. I just happened to make my "savings" page a child page of the form. No problem.

I tried putting the form on a new page (changed code back to .entry-content) and it keeps giving the same error

Uncaught ReferenceError: jQuery is not defined

and it's telling me that it's on the first line of the script you sent me.  It may be a theme conflict of some sort.

Change all instances of jQuery to $.

You mean in the theme or just the script?

Just the script I provided.

Still the same error.  It's fine, I'll try to find some sort of workaround.

Ok. It depends on how your theme is calling jQuery. By default Wordpress comes with a version of jQuery that looks for the word "jQuery" throughout your scripts. The standard code it looks for without Wordpress is "$". That is why I mentioned both. Good luck!

Discussion closed.