Commit 0ca96cea authored by Jerome Mariette's avatar Jerome Mariette
Browse files

add autocomplete on email

parent 64465660
......@@ -890,6 +890,49 @@ $(function () {
}
});
// email autocomplete
$("#user_email_val").autocomplete({
source: function( request, response ) {
$.ajax({
url: "index.php?eID=tx_nG6&type=autocomplete&gender=email&project_id=" + $("#current_project_id").val()+"&email_start="+$("#user_email_val").val(),
dataType: 'json',
success: function( data ) {
// create data backup structure
data.map(function( item ){
user_back[item.uid] = new member(item.username, item.first_name, item.last_name, item.password, item.email, item.right_id, item.group);
});
// print result in autocomplete list
response( $.map( data, function( item ) {
return {
label: item.first_name + " " + item.last_name + " [" + item.username + "]",
value: item.username,
uid: item.uid
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
clear_error_msg();
},
search: function(event, ui) {
var reg = /^[a-zA-Z0-9âàêëéèûùîïôç]+$/;
if( !reg.test($("#user_group_val").val()) ){
return false;
}
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
// username autocomplete
$("#user_name_val").autocomplete({
source: function( request, response ) {
......@@ -916,7 +959,7 @@ $(function () {
},
minLength: 2,
select: function( event, ui ) {
// update the others fields automatically
// update fields automatically
clear_error_msg();
update_fields(ui.item.uid);
lock_fields(1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment