We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
May 19, 2022 2:04 PM
I've a session area protected by login/registration. In this area I did set a form that collecting certain information to create records in a custom object. This works fine.
Now, my users ask me Why my progress in form don't stay in each field (even before of submit form) if I'm logged in? I've active to this form the option "Pre-populated fields" but seems that don´t works.
Actually for example, if i and any user fill only some fields and something happen (close browser, logout) the form is reset it. losing all preview data filled.
There is a way to save or pre-save this data either browser or session?
Solved! Go to Solution.
May 20, 2022 7:04 AM
You could do this with local storage (better than session storage):
window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
let email = document.querySelector('input[type=email]').value;
localStorage.setItem('email', email);
// repeat for other values you want
}
});
May 20, 2022 7:04 AM
You could do this with local storage (better than session storage):
window.addEventListener('message', event => {
if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
let email = document.querySelector('input[type=email]').value;
localStorage.setItem('email', email);
// repeat for other values you want
}
});