adding valid attribute function.