form dialog refactoring