Hello,
I want to validate a non-required text field that can hold an email
address. That is, it can be empty, but if it does contain text it must
be a valid email address. I use jQuery 1.2.2 and jQuery validation
plug-in v1.2. This code allows any input for some reason:
    <form id="form1" action="/home.ashx/sendmail" method="post"
enctype="application/x-www-form-urlencoded">
    <div>
        <div>
            <label for="ContactRequest_Email">Optional email:</label>
            <input id="ContactRequest_Email" dir="ltr" title="Optional
email" name="ContactRequest_Email" value="" type="text" />
        </div>
        <div>
            <button type="submit" >Send</button>
        </div>
    </div>
    </form><script type="text/javascript">$(function () { $
("#form1").validate({rules:{contactRequest_Email:
{email:true}},messages:{contactRequest_Email:{email:"The value must be
a valid e-mail address."}}}); });</script>

What I'm doing wrong?
Felix.

Reply via email to