Skip to content
Snippets Groups Projects
Unverified Commit 13ef4a3c authored by Stéphane Laurière's avatar Stéphane Laurière Committed by GitHub
Browse files

XWIKI-18002: Add autocomplete attributes to fields when editing the user...

XWIKI-18002: Add autocomplete attributes to fields when editing the user profile personal information (#1666)

* Add 'autocomplete' attributes dynamically in JavaScript once the form
  is loaded
parent 5da8dd66
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,46 @@ ...@@ -141,7 +141,46 @@
<property> <property>
<code>require(['jquery', 'xwiki-meta'], function ($, xm) { <code>require(['jquery', 'xwiki-meta'], function ($, xm) {
'use strict'; 'use strict';
$(function() {
$(function() {
/** Add autocomplete attributes to ease form filling. */
var fieldsPurposes = [
{
'name': 'first_name',
'purpose': 'given-name'
},
{
'name': 'last_name',
'purpose': 'family-name'
},
{
'name': 'company',
'purpose': 'organization'
},
{
'name': 'email',
'purpose': 'email'
},
{
'name': 'phone',
'purpose': 'tel'
},
{
'name': 'address',
'purpose': 'street-address'
},
{
'name': 'blog',
'purpose': 'url'
}
];
fieldsPurposes.forEach(function (entry) {
var inputField = $('[name$="' + entry.name + '"]');
if (inputField.length === 1) {
inputField.attr('autocomplete', entry.purpose);
}
});
/** /**
* Save the new user status. * Save the new user status.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment