You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
724 B
21 lines
724 B
$(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() ); |
|
}); |
|
}); |