added function of validate form input