In Apex, a form page is rarely standalone; it is usually called from an interactive report (IR) page via "Create" or "Edit" buttons:
- in the first case ("Create"), you don't pass anything to the form
- if you "Edit" current record, ID is being passed from IR to a form
You said that you have user ID, so I'll presume that it is the 2nd case.
If that's so, one way to do what you want is to modify ID item to be a Select List item. It uses List of Values - in your case, you'd use query, e.g.
select emp_name as display_value,
emp_id as return_value
from hr_employees
which then automatically displays employee name (instead of its ID). If you want to display ID as well, concatenate it to emp_name.
On the other hand, if you - for some reason - manually enter ID into the form item, create dynamic action (DA) on it so that when its value changes, a Set Value DA will populate the name item.
select emp_name
from hr_employees
where emp_id = :P3_EMP_ID;
Make sure to put P3_EMP_ID into "Items to submit" property; affected element is item named P3_NAME.
