I mean remove the error messages. Whenever I hit submit, and if a field
still does not pass the validation rule, the old error message remains, and
the same message gets appended twice.

simple example

(error message)
input field
[submit]

I click submit, and input field still doesnt pass, now my page has
(error message)
(error message)
input field
[submit]

So, how come the error message isn't being cleared?

I had to add a custom errorPlacement override, though there are still cases
it doesnt work properly, for example if I make sure two passwords are the
same.

Here is my code snippet, please let me know what I am configuring wrong. If
I have the replaceWith line commented out (as below) then the error messages
dont clear.

  <script type="text/javascript">
  $(document).ready(function(){
    $("#command").validate({
      errorPlacement: function(label, element) {
        //$(element).prev(".error").replaceWith("");
        label.insertBefore( element );
      },

      rules: {
        "profileBean.loginEmail": {
                required: true,
                minlength: 5,
                                email:true
            },
        "password": {
                                                required:true,
                                                minlength:5
                                },
                "passconfirm":{
                                    required:true,
                                    minlength:5,
                                    equalTo:"#password"
                }
      },
      messages:{
          "profileBean.loginEmail":{
                              required:"Email must be supplied",
                              minlength:"specify at least 5 characters",
          }
       }
    });
  });
  </script>



  <form id="command" action="someurl" method="POST">

    <tr>

        <input id="profileBean.loginEmail" name="profileBean.loginEmail"
class="inputFld" type="text" value=""/></td>
        </tr>
    <tr>


        <input id="password" name="profileBean.password" class="inputFld"
type="password" value=""/></td>
        </tr>
    <tr>

        <input type="password" id="passconfirm" name="passconfirm"
class="inputFld" /></td>
        </tr>
    <tr>
        </form>


Thanks,
Josh


On Wed, Jun 25, 2008 at 3:22 AM, Jörn Zaefferer <
[EMAIL PROTECTED]> wrote:

>
> What are you referring to with "clear"? They are hidden by default,
> isn't that enough?
>
> Jörn
>
> On Wed, Jun 25, 2008 at 4:26 AM, Josh Joy <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > How do I clear the error messages when it passes the validation rules? I
> was
> > hoping it would clear automatically. Is there some value I need to set or
> > some configuration necessary?
> >
> > Thanks,
> > Josh
> >
>

Reply via email to