length validator and clearing fields