How to read a field in dir_user using custom html in form
I am building a string that is used for the UserID based on part of the first and last names as the form is being filled in. This UserID needs to be unique and is entered into a field in the dir_user table as well as an application-specific table. As the user leaves the Last name field, when the UserID is built, I need to read the dir_user table to detect a possible duplicate. How do I access that table while executing the javascript in the Custom HTML on the form?
The sample below is executed in the $(document).ready(function() ...
$('input[name="usersLname"]').change( function() {
if($('input[name="usersLname"]').val()!='' && $('input[name="usersFname"]').val()!='')
{
var lname=$('input[name="usersLname"]').val();
var fname=$('input[name="usersFname"]').val();
var usersIdent=lname.substring(0,4)+fname.substring(0,1)+'001';
$('input[name="usersIdent"]').val(usersIdent.toUpperCase());
$('input[name="usersLogin"]').val(usersIdent.toUpperCase());
};
});