This is my first time trying to use the validate script. It looks
great, but something is wrong with my set up. I basically tried
copying the functionality of the simple demo.

<script type=text/javascript src=/js/jquery-1.2.6.min.js></script>
<script type=text/javascript src=/js/jquery.validate.js ></script>
<script type=text/javascript>
        $(document).ready( function(){
                $('#regForm').validate();
        });
</script>
<h2>Register</h2>
<table cellspacing=4    >
        <form id=regForm action=/user/register method=post>
        <tr>
                <td class=formLabel><label for=first_name>First 
Name:*</label></td>
                <td><input type=text name=first_name id=first_name
class="required"></td>
        </tr>
        <tr>
                <td class=formLabel><label for=last_name>Last 
Name:*</label></td>
                <td><input type=text name=last_name id=last_name 
class="required"></
td>
        </tr>
        <tr>
                <td class=formLabel><label for=email>Email:*</label></td>
                <td><input type=text name=email id=email class="required 
email"></
td>
        </tr>
        <tr>
                <td colspan=2 align=center><input class=toggleButton 
id=formButton
type=submit value="Send Application"></td>
        </tr>
        </form>
</table>

It validates when I hit the send button, and displays error messages
like I would expect. However, there are a couple of problems.

1. It only validates when I hit the submit button. If I go back and
try to fix the mistakes, they don't revalidate until I hit submit
again.
2. If I leave something blank or there is some other error, the
original error message doesn't go away. So for my email address, if I
put in an invalid email address after having left it blank on the
first go-round the error messages will stack up "Please enter a valid
email addres.This field is required."

It seems pretty straightforward, but obviously I'm doing something
wrong. Can someone offer a bit of guidance?

-Sean

Reply via email to