Add error handling to edit form