Disable auto fill

niharika verma
Tera Expert

After a REQ is submitted say REQ1, a user might use the browser go back feature to fill in details that he missed when submitting this REQ1 form. When he click the back button there are values already populated from his REQ1 request.
To him he thinks that he is editing REQ1, but in reality he created REQ2 which he is unaware of.
is there a way to either clear the form when he uses the browser back button or may be display a warning to not edit the form or simply not allow him to do it.

5 REPLIES 5

SaaniyaChugh1
Tera Contributor

Hi @niharika verma ,

According to me, this is not possible.This is the expected behavior of the platform, the back button is expected to render the previously filled data.

However, I saw the following code somewhere in the community. Feel free to take a look at it, to see if it helps,


Write this in your client controller (history contains your browser history)

history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};




Cheers,
Saaniya Chugh

Ankur Bawiskar
Tera Patron
Tera Patron

@niharika verma 

so user already submitted REQ1 and goes back to browser, it will open up a fresh catalog form again and if user submits a new REQ2 gets created.

The form which gets opened on browser back will be a fresh form already

I didn't get your point to clear the form?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@niharika verma

I agree with what Anurag said.

Seems the browser is performing auto-fill and filling the variable data again.

You can try to add this attribute in each of your variable and see if auto fill is blocked. I haven't tested though

autocomplete=off

check this blog as well

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

I feel it may be the browser that is remembering the values and not ServiceNow?

Can you check and confirm this.

 

-Anurag