added validation so form will not save if there are no fields defined