adding validation to edit and create event