Try to add $(this).valid(); in the onClose callback, assuming "this"
refers to the date input field. That will trigger the validation,
updating the error message.

Jörn

On Thu, Jan 29, 2009 at 2:19 PM, kathb4 <[email protected]> wrote:
>
> I have a form which validates fine with the jquery validation plugin.
> I want it also to validate that a date has been entered. If the date
> field is blanks - it shows (correctly) the error message.  If, then,
> the user clicks in the field and selects a date, the validation error
> message does not go away.
>
> reading around it seems it has to do with focus or blurring?
>
> I almost have it working. That is I have it so an error message comes
> up, user selects a date and then clicks elsewhere the error message is
> gone. However that is unlike the other fields where if there is an
> validation error, as soon as the user starts to enter something, the
> error message goes away.
>
> What else other than focus to I need to do so the error message goes
> away once a user has used the jquery-ui datepicker to select a date?
>
> What I have:
> [code]
> // datepicker
> $("#mydate").datepicker({
>        dateFormat: "yy-mm-dd"
>      , hideIfNoPrevNext: true
>      , onClose: function() {
>               $(this).next().focus();
>         }
>    });
> // validation
>
> $("#myForm").validate({
>        rules: {
>          myDate: {
>            required:       true
>            ,dateISO:      true
>          }
>          ,plant_roots:    "required"
>        },
>        messages: {
>            ,myDate:       Please enter the date you collected your
> sample."
>            ,plant_roots:  "Please choose one."
>        }
>      });
> [/code]
>
> thanks
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to