I like that comments are added! There could be another line or two about the general "goal" of the function - what is the listener doing and why? In this particular case, it could be useful to explain that the listener handles validity checking, for example.