Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differentiating multiple forms on one site for autocomplete

What's the logic behind browsers autocomplete - how do they differentiate between multiple forms on one site or even page? Let's assume a situation where you have an ecommerce-site with a login (user/pass) and gift-cards on checkout (giftcardnumber/pass). How do you tell a browser that these are not the same fields and must be stored separately?

Of course we could just disable autocomplete on the 2nd form, but that's not a pretty solution.

Is there a standard on autocompletion? Is the forms ID the key for storing it? Since Windows 10, the situation seems to be even more complicated, thanks to the cloud-sync feature, which syncs passwords and other form-values across browsers.

Thanks!

like image 311
Raphael Jeger Avatar asked Dec 04 '15 14:12

Raphael Jeger


People also ask

Can I have multiple forms on one page?

You can handle multiple separate forms on a single page by including a hidden field identifying the submitted form. You can use formsets to create multiple different instances of the same form on a single page.

What is difference between autofill and autocomplete?

Autocomplete And Autofill #Autofill is a browser feature that allows people to save information (on the browser or the OS) and use it on web forms. autocomplete is an HTML attribute that provides guidelines to the browser on how to (or not to) autofill in fields in a web form.

Can you have 2 forms on an HTML page?

Yes, we can use multiple tags inside one single HTML page. Sometimes we need to submit two distinct data from a single HTML page. To do so we need to use multiple tags.

How does autocomplete work in forms?

After you interact with the first field in the address form, the browser shows you a list of saved addresses. You can choose one, and the browser fills in all fields related to the address. Autofill makes filling out forms fast and easy. Not every address form has the same fields, and the order of fields also varies.


1 Answers

Here's a good answer that explains a little on how browser's determine autocomplete

Basically, browser's rely on the "name" attribute of an input and a lot of other contextual information (class/input type/label) to determine what fields can be autocompleted with what (type) of information.

Here's is a little more detail on the autofill html standard. https://html.spec.whatwg.org/multipage/forms.html#autofill

like image 50
mani Avatar answered Oct 24 '22 00:10

mani