I have a form I want to validate a textarea on:
<form action="" id="dialog">
<textarea name="message-text" class="message-text" rows="5" cols="30" required="true" style="margin-top: 35px;margin-bottom: 25px"></textarea>
<span style="color: red; display: none" class="error-message">An error occured while sending the message.</span>
<a href="" class="button send-message">Send</a>
<a href="" class="button cancel-sending">Cancel</a>
</form>
When I call
$('#dialog').valid()
with an empty textarea it returns true
while I expect it to return false.
Internally when it collects rules for the form the value of element.attr('required')
ends up being 'required'
for some reason when the value of the attribute is 'true'
and the required method returns 'dependency-mismatch'
. I'm not sure what these things mean but probably they are connected with valid()
returning true
and not false
as I expect it.
What am I doing wrong here?
Edit: Sorry for my blunder in the question, I meant .valid()
not .validate()