Populating form fields from user input from earlier on the page

forms

#1

Alright, so here is the situation I’m in. A website I’m building has a page with a calculator. If a user is curious as to the cost and storage amount that a certain number of users presents within the business, they input a number in the calculator, and the calculator will spit out the storage amount and monthly cost for the number of users.

This works and is fine, the issue I’m having is that if a user likes what they see, they hit a “Go” button and are led to a hubspot form. There is a field called “number of users” that is supposed to pre-populate with whatever number the user put into the calculator before. It’s giving wild and inaccurate numbers.

Here’s the related code.
var inputBox = //where the calculator input is
inputBox.onchange = function (){
document.getElementById(‘hubspot form field for number of users here, giant number’).value = inputBox.value;
}

Currently this is all the code relating to the hubspot form. It displays the correct number, but when input, the number changes and is very wrong. What else can I do to ensure the correct information is going to Hubspot?

Thanks for your time.