I have a form module on a page that has some session values in play. The session values are set and stored with javascript to set values based on items the user has clicked on within the page… NOT within a form. It’s a multi-page process where various items are selected, then data is processed at the end after submitting a simple form. THAT ALL WORKS. But I’m trying to take these selection values and add them to the form in hidden fields so the submission record shows everything that the user selected prior to submitting the form.
I have a function that puts the session values into variables prior to running some calculations. Like this:
var package = sessionStorage.getItem("package");
I want to add code to this function where this variable is sent as the value of a hidden form field. From some Googling, I tried this:
hbspt.forms.create({
portalId: "6040502",
formId: "84dc8257-150c-4710-944d-587205ccd398",
onFormSubmit: function($form){
$("input[name='msp_package']").val(package).change();
}
});
No matter what I try with this, nothing gets added to the form submission. I’ve got a missing piece somewhere.