I wanted to know how to use oninvalid in the text area.
<textarea type="text" pattern=".{1,255}" id="mensagem" name="mensagem" class="form-control no-resize" rows="6" placeholder="A mensagem" required maxlength="255" autofocus
oninvalid="setCustomValidity(this.validity.patternMismatch ? 'Quantidade de caracteres excedida.' : '')"></textarea>
Well, this is not working!