I have the following:
I'd add another attribute oninvalid.
oninvalid
oninvalid="setCustomValidity('Please enter at least 5 characters')"