Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Autogenerate or remove username


peterverkooijen
Participant

@peterverkooijen

Alternative solution: Use the following Javascript to generate a username on typing:

function copyinputuser()
{
var tmp = document.getElementById('field_1').value;
tmp = tmp.toLowerCase().replace(/^\s+|\s+$/g, "").replace(/[_|\s]+/g, "");
tmp = tmp.replace(/[^a-z0-9-]+/g, "").replace(/[-]+/g, "").replace(/^-+|-+$/g, "");
document.getElementById('user_name').value = tmp;
}

And then add onkeyup=”copyinputuser()” to the field_1 input tag, which requires an ugly hack in a core file.

Skip to toolbar