<timepicker id="time-picker"
onchange="alert('time-picker: ' +
this.dateValue);"
hideseconds="true">
I'm having problems where the control doesn't seem to be updating correctly.
If I change the values in the control using the up/down arrows and the
mouse, the alerts
contain the modified values.
However, if I use the keyboard, enter text in one of the fields (for
example, change the hour),
and then hit tab, the alert does *not* reflect the changes.
Why does text input not get reflected in the control values? It does
display the value
correctly, but when you query the control for "dateValue" or other it does
not match
what is displayed.
What am I doing wrong?
Thanks,
-- Greg
-jy
(just guessing quickly)
For example, say I start with 1:00. I change this to 2:00, I still get 1:00
in
my alert. If I then change to 3:00, I get 2:00 in my alert.
It's almost as if the value isn't really changed, or reflected in the
control, until the
onchange event has completed. But why would it work with the up/down arrows
then?
-- Greg
"JY" <j...@zooc.org> wrote in message
news:Wsednb6htPYLEpvR...@mozilla.org...
Greg, the dateValue will be set when the change event fires, however
this is not the case as long as you have the focus in the field. See the
datetimepicker.xml binding.
Daniel
This still doesn't seem right. The change event *is* firing, which is why I
see my alert. But
the value has not been updated.
I have tried clicking on another control too, but that still shows me the
wrong value. So
whether I tab or click on another control the change event does fire, but
the value is
not right.
Or do I have to handle the focus event (which one is that?) to get the
value? That doesn't seem
right to me...
-- Greg
"Daniel Kirsch" <Iwillnotr...@gmx.de> wrote in message
news:aaGdncSae4VTA5vR...@mozilla.org...
Try something like this:
onchange="var picker=this; window.setTimeout(function() { alert(picker.dateValue); }, 0);"
My guess is, the control itself handles onchange event to update its internal data from the text you've just entered - but your handler happens to fire first. setTimeout delays your processing until all other event handlers got a go at the event.
Igor Tandetnik
>My guess is, the control itself handles onchange event to update its internal data from the text you've just entered - but your handler happens to fire first.
>
That sounds like a bug that should be fixed (probably in this case the
control should capture the change event so that it receives it before
the onchange attribute).
--
Warning: May contain traces of nuts.