This question is locked. New answers and comments are not allowed.
Hello guys.
I was testing the DateTime Picker example and I may have found a problem. In the first input, clear the date and type "1" then click somewhere else. The input will appear now as invalid (red color). Now click again in the input and just click out, without changing the value. The input will be now marked as valid (no red color).
I think the reason why this happens is because the event used is change(), not the focusout() or blur() (or something like that). There's some way I can validate the input everytime the user lefts the field? I was thinking about wrapping the focusout() directly to the change() event by hand using jQuery. What do you guys think?
Edit: a temporary solution...
Edit2,3: fixed a few problems in the code below.
Thanks a lot,
Ricardo
PS: I've been using these extensions in the last 2 or 3 weeks and they're awesome! :)
I was testing the DateTime Picker example and I may have found a problem. In the first input, clear the date and type "1" then click somewhere else. The input will appear now as invalid (red color). Now click again in the input and just click out, without changing the value. The input will be now marked as valid (no red color).
I think the reason why this happens is because the event used is change(), not the focusout() or blur() (or something like that). There's some way I can validate the input everytime the user lefts the field? I was thinking about wrapping the focusout() directly to the change() event by hand using jQuery. What do you guys think?
Edit: a temporary solution...
Edit2,3: fixed a few problems in the code below.
// Save the close function somewhere.$(this).data('tDatePicker').dateView.oldClose = $(this).data('tDatePicker').dateView.close;// On close, update the date to make sure it's valid. So if the user type gargabe in the field and click out (which triggers the close), the field will be red (which means invalid date).var that = this;$(this).data('tDatePicker').dateView.close = function () { $(that).data('tDatePicker')._update($(that).val()); $(that).data('tDatePicker').dateView.oldClose();};// When we lost focus, and if the calendar is not open, revalidate.$(this).focusout(function () { if (!$(this).data('tDatePicker').dateView.isOpened()) { $(this).data('tDatePicker')._update($(this).val()); }});Thanks a lot,
Ricardo
PS: I've been using these extensions in the last 2 or 3 weeks and they're awesome! :)