CMS Development

DanielSanchez
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

autocomplete="off" on hubspot form

SOLVE

Hi, 

 

Any way to implement an "autocomplete=off" of html, to incorporate the HubSpot form? I need the field to be always typed, without any type of browser autocompletion or history.

 

Thanks!

1 Accepted solution
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

autocomplete="off" on hubspot form

SOLVE

@DanielSanchez I don't think there is a setting for this built-in to HubSpot forms. However, you could always add the attribute with javascript after the forms loads on the page assuming you aren't using one of the iframe embeds. For example:

window.addEventListener('message', event => {
   if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
       $('form').attr('autocomplete', 'off');
   }
});

 

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

2 Replies 2
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

autocomplete="off" on hubspot form

SOLVE

@DanielSanchez I don't think there is a setting for this built-in to HubSpot forms. However, you could always add the attribute with javascript after the forms loads on the page assuming you aren't using one of the iframe embeds. For example:

window.addEventListener('message', event => {
   if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
       $('form').attr('autocomplete', 'off');
   }
});

 

Stefen Phelps, Community Champion, Kelp Web Developer
adriano-azos
Participant

autocomplete="off" on hubspot form

SOLVE

This code doesn't work for me, have an alternative way to disable it?
I used the setTimeout to set the checkbox as false but on submitting the HubSpot pre-populates automatically even if the user doesn't change the input.

0 Upvotes