add invalid and valid classes to inputs