Create populateForm function