simple validator using javascript