Hi There,
I have a couple of modules…hr_employees and hr_employees_expenses (which has a many-2-one relationship with hr_employees)
All users of the crm are in the employees table. so what i am needing it to do is pre populate the employee field in custom_employee_expenses based on the user that is currently logged in.
I tried creating some jquery to do this for me but i get an error when i tried to save the record. If it was just a normal text field then this would have worked a treat. the code hides the assigned to box and the buttons and table cell value and populates the other field.
$(document).ready(function(){
var txt = $('input:text[name=hr_employee_expenses_hr_employees_name]').val();
if(jQuery.trim(txt).length == 0)
{
$("#assigned_user_name_label").hide();
$('button:button[name=btn_clr_assigned_user_name]').hide();
$('button:button[name=btn_assigned_user_name]').hide();
$('input:text[name=assigned_user_name]').hide();
var user_name = $('input:text[name=assigned_user_name]').val();
$('input:text[name=hr_employee_expenses_hr_employees_name]').val(user_name);
}
});
How can i get it to pre populate this field properly based on the assigned to?
thanks
Jamie