fixed duplication of code when generating add/edit forms issue