added validation to the frontend form