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
Showing Calculation Result On a New Page
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?
October 10, 2018 at 9:59 pm
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?
October 11, 2018 at 11:07 am
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/
October 11, 2018 at 11:15 am
Provide a screenshot of your form settings.
October 11, 2018 at 11:25 am
Attached.
Attachments:
October 11, 2018 at 11:34 am
Are you using a view for the results on the "your-revenue-score"?
October 11, 2018 at 11:36 am
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.
October 11, 2018 at 11:41 am
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.
October 11, 2018 at 11:54 am
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.
October 11, 2018 at 12:51 pm
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?
October 11, 2018 at 12:56 pm
Honestly I'm not sure how the entry is being saved. But I did attach the form for you to test out.
October 11, 2018 at 12:57 pm
I don't see an attachment.
October 11, 2018 at 12:57 pm
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
October 11, 2018 at 1:47 pm
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?
October 11, 2018 at 2:17 pm
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.
October 11, 2018 at 9:32 pm
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>
October 12, 2018 at 9:32 am
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>
October 12, 2018 at 9:37 am
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.
October 12, 2018 at 9:54 am
Still no luck, still get the jquery is not defined error even after changing to .thrv_wrapper and correcting the previous error.
October 12, 2018 at 10:40 am
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/
October 12, 2018 at 10:53 am
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.
October 12, 2018 at 10:56 am
I don't believe that matters. I just happened to make my "savings" page a child page of the form. No problem.
October 12, 2018 at 11:03 am
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.
October 12, 2018 at 11:03 am
Change all instances of jQuery to $.
October 12, 2018 at 11:05 am
You mean in the theme or just the script?
October 12, 2018 at 11:05 am
Just the script I provided.
October 12, 2018 at 11:08 am
Still the same error. It's fine, I'll try to find some sort of workaround.
October 12, 2018 at 11:09 am
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.