Looks like your markup is invalid: The form doesn't surround the
table, instead its closed instantly. Its weird that the validation
works at least in parts.

This is the rendered html:

<table>
<form ... /> <-- closed!
<tbody>...</tbody>
</table>

Jörn

On Thu, Jun 26, 2008 at 6:39 PM, Josh Joy <[EMAIL PROTECTED]> wrote:
> Sorry, try here
> http://snippets.dzone.com/posts/show/5700
>
> On Thu, Jun 26, 2008 at 2:50 AM, Jörn Zaefferer
> <[EMAIL PROTECTED]> wrote:
>>
>> I don't see an attachment - could you upload that somewhere?
>>
>> On Wed, Jun 25, 2008 at 11:57 PM, Josh Joy <[EMAIL PROTECTED]> wrote:
>> > Ok, I have attached a sample html.
>> >
>> > It seems that using tables is causing some confusion? I'm not sure.
>> >
>> > Hope you can pinpoint what I'm doing wrong.
>> >
>> > Note <input id="password" name="profileBean.password" type="password"
>> > value=""/>
>> > I'm using spring so it does the data object binding for me which is the
>> > reason for the name. I changed the id to "password" cuz I was figuring
>> > that
>> > the Javascript jquery validate lookups were done by id.
>> >
>> > Thanks,
>> > Josh
>> >
>> >
>> > On Wed, Jun 25, 2008 at 1:23 PM, Jörn Zaefferer
>> > <[EMAIL PROTECTED]> wrote:
>> >>
>> >> That looks like a bug. Once a label is inserted, its supposed to be
>> >> updated and not appended again. Could you upload a testpage and post
>> >> the url?
>> >>
>> >> Jörn
>> >>
>> >> On Wed, Jun 25, 2008 at 6:00 PM, Josh Joy <[EMAIL PROTECTED]> wrote:
>> >> > 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
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>> > Email Address
>> > Password
>> > Re-enter password
>> >
>> >
>
>

Reply via email to