validation is not working and can't perform insert into database