Holger Frey
7 years ago
6 changed files with 46 additions and 12 deletions
Before Width: | Height: | Size: 13 KiB |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
$(function() { |
||||
|
||||
function capitalize(s){ |
||||
return s.replace( /\b./g, function(a){ return a.toUpperCase(); } ); |
||||
}; |
||||
|
||||
function generate_user_name() { |
||||
var first_name = $('#registration_first_name').val(); |
||||
var last_name = $('#registration_last_name').val(); |
||||
var user_name = capitalize(first_name) + capitalize(last_name); |
||||
return user_name.replace( /[\s-]/g, '') |
||||
}; |
||||
|
||||
// autocomplete of the username (registration form)
|
||||
$('#registration_first_name').keyup(function () { |
||||
$('#registration_username').val( generate_user_name() ); |
||||
}); |
||||
$('#registration_last_name').keyup(function() { |
||||
$('#registration_username').val( generate_user_name() ); |
||||
}); |
||||
}); |
Reference in new issue