First, we need to retrieve the record to be edited. There is an id field in the employees table that has a unique number for each row, and this field is used to identify the row (being the primary key).
We also included a hidden field in the views\emplistall.dt file: the id field, which has the value of the id field in the employees table, and which we can use as a key to retrieve the record so we can populate the form with the employee data:
input(type="hidden", name="id", value="#{e.id}")
We can use that hidden field then.
Edit source\empcontrol.d and append this method:
void getEditEmployee(int id)
{
Employee e = empModel.getEmployee(id);
render!("empedit.dt", e, departments, paygrades, provinces);
}
This method calls the empModel.getEmployee() method with the id as the argument, then receives the returned Employee with the needed data, which is used to populate the form empedit.dt, which we should create next.