adds required attribute to input