+ 1

What is the use of "autocomplete" attribute in html5 forms.

5th May 2017, 5:30 AM
Rajeev Jain
Rajeev Jain - avatar
9 Réponses
+ 6
'autocomplete' attribute allow ( or disallow ) browser form cache capabilities to suggest prefilled fields to user while typing input... https://www.w3schools.com/tags/att_input_autocomplete.asp
5th May 2017, 5:36 AM
visph
visph - avatar
+ 5
'autocomplete' will also work for form fields with generic 'name' attribute: browsers will suggest input previously entered, even if in other web pages. 'autocomplete' is use to suggest previous user entries... to suggest more stuff ( not previously cached on user side ), you'll have to handle this through JS and server side language ( AJAX will be useful to interface between them ) as suggested by @Apel Mahmod ;)
5th May 2017, 5:57 AM
visph
visph - avatar
+ 4
what visph said is right. I just want to add that autocomplete will only work if the user submitted the form once. use javascript autocomplete for static or dynamic data. in this way user doesn't have to submit the form first
5th May 2017, 5:50 AM
Apel Mahmod
Apel Mahmod - avatar
+ 4
You can probably use 'autocomplete' attribute in both <form> and <input>, but I don't really know, so I can't swear ;P You have to try it yourself, to see how it react in real situation to see... Anyway, this link can provide more detailed technical stuff about it: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
5th May 2017, 7:16 AM
visph
visph - avatar
+ 4
'autocomplete' is attribute of <input> AND <form>... I understood your last question as can we use in both at same time: wasn't it?
5th May 2017, 7:31 AM
visph
visph - avatar
+ 4
@Rajeev Jain wrote: << if you don't use the name attribute in <input> tag the autocomplete="on" is not worked. >> Without 'name' attribute, it'll store a lot of field values for all undefined input name reference, and it'll display not appropriate suggestions later... as storing by key/value pair allow to suggest only same type on data for named <input>s ;) So, default behavior sounds more logical to disable always autocomplete feature for undefined name <input>s ^^
5th May 2017, 9:27 AM
visph
visph - avatar
0
can we use autocomplete attribute both in <form> tag and <input> tag
5th May 2017, 7:10 AM
Rajeev Jain
Rajeev Jain - avatar
0
in w3schools.com autocomplete attribute is use inside the <input> tag
5th May 2017, 7:19 AM
Rajeev Jain
Rajeev Jain - avatar
0
@visph one thing is also most important about autocomplete. if you don't use the name attribute in <input> tag the autocomplete="on" is not worked.
5th May 2017, 9:19 AM
Rajeev Jain
Rajeev Jain - avatar