added validation
solved ajax error and error when form is saved