added validation for submit