added validator javascript