CMS Development

FEscudero
Member

Calculated fields on a second form

SOLVE

Hi,

 

I have a form in a landing page where the user selects a building from a drop list and selects the number of vehicles she has. Then with a workflow, I assign a parking space value depending on the building. To calculate the total amount I have a custom calculated field that multiplies the parking space value and the number of vehicles. 

 

The deal amounts generated from the form are fine, however after submiting the form the user goes to the next landing page to confirm the amounts. When I try to display the total amount to pay, it appears blank?

 

Could this be because there is no time to calculate the field? I tried to put another step in between to have more time, but didn't work either.

 

0 Upvotes
2 Accepted solutions
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Calculated fields on a second form

SOLVE

@dennisedson @FEscudero in the past when I've tried using a value that was just submitted in a form on a thank you page I've added a 2 second delay and it worked every time. I wasn't doing any workflow/math in between that step so I'm not sure if that would affect the time.

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Calculated fields on a second form

SOLVE

@Bragg what I've done in the past that worked well at the time was add a script to the thank you page that checks for the "submissionGuid" query parameter, if it has it put up a loading indicator for 2 seconds then refresh the page without that query parameter. Here's my HubL/Javascript code for that:

{% if request.query is string_containing "submissionGuid" %}
{# give hubspot time to populate it's database after a user submits new data #}
<div class="loading-spinner">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z"/></svg>	
</div>
<script>
setTimeout(function(){
  window.location = window.location.pathname;
}, 2000);
</script>
{% endif %}

Then just add some CSS to position the loading indicator as an overlay or what have you.

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

4 Replies 4
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Calculated fields on a second form

SOLVE

@Bragg what I've done in the past that worked well at the time was add a script to the thank you page that checks for the "submissionGuid" query parameter, if it has it put up a loading indicator for 2 seconds then refresh the page without that query parameter. Here's my HubL/Javascript code for that:

{% if request.query is string_containing "submissionGuid" %}
{# give hubspot time to populate it's database after a user submits new data #}
<div class="loading-spinner">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z"/></svg>	
</div>
<script>
setTimeout(function(){
  window.location = window.location.pathname;
}, 2000);
</script>
{% endif %}

Then just add some CSS to position the loading indicator as an overlay or what have you.

Stefen Phelps, Community Champion, Kelp Web Developer
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

Calculated fields on a second form

SOLVE

@dennisedson @FEscudero in the past when I've tried using a value that was just submitted in a form on a thank you page I've added a 2 second delay and it worked every time. I wasn't doing any workflow/math in between that step so I'm not sure if that would affect the time.

Stefen Phelps, Community Champion, Kelp Web Developer
Bragg
Participant

Calculated fields on a second form

SOLVE

@stefenI'm having this same issue with another property. How do you add a 2 second delay? Javascript?

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Calculated fields on a second form

SOLVE

Hey @FEscudero 

I would say it is not the calculation.  It is the indexing of that newly updated property. 

That page is being loaded before there is a value in that property.

You can test to see if it is working by previewing that second page as a contact who has filled out the form.  You should see the value then.   I am not sure what the delay amount should be. 

@stefen  any suggestions?

0 Upvotes