added JS validations to edit event