CPI Ordering System (the old version)
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

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() );
});
});