Updating a timepicker control via text input

I have the following control in my XUL application:

        <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 


0
Greg
6/2/2010 4:15:02 PM
mozilla.dev.tech.xul 2282 articles. 0 followers. Post Follow

6 Replies
633 Views

Similar Articles

[PageSpeed] 1

did you check whether either $('time-picker').value or
$('time-picker').getAttribute('value') has the correct kbd-edited date ?

-jy
(just guessing quickly)

Greg Allen wrote on 02/06/2010 18:15:
> I have the following control in my XUL application:
> 
>         <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 
> 
> 

0
JY
6/2/2010 5:08:02 PM
I just did.  None of those has the new value - all have the old value.

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" <jyb@zooc.org> wrote in message 
news:Wsednb6htPYLEpvRnZ2dnUVZ_s6dnZ2d@mozilla.org...
> did you check whether either $('time-picker').value or
> $('time-picker').getAttribute('value') has the correct kbd-edited date ?
>
> -jy
> (just guessing quickly)
>
> Greg Allen wrote on 02/06/2010 18:15:
>> I have the following control in my XUL application:
>>
>>         <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
>>
>>
> 


0
Greg
6/2/2010 5:30:57 PM
Am 02.06.2010 19:30, schrieb Greg Allen:
> I just did.  None of those has the new value - all have the old value.

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
0
Daniel
6/2/2010 6:11:24 PM
Hi 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" <Iwillnotread_daniel@gmx.de> wrote in message 
news:aaGdncSae4VTA5vRnZ2dnUVZ_sSdnZ2d@mozilla.org...
> Am 02.06.2010 19:30, schrieb Greg Allen:
>> I just did.  None of those has the new value - all have the old value.
>
> 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 


0
Greg
6/2/2010 7:38:43 PM
Greg Allen <gregory.allen@sierraatlantic.com> wrote:
> I have the following control in my XUL application:
>=20
>        <timepicker id=3D"time-picker"
>                           onchange=3D"alert('time-picker: ' +
> this.dateValue);"
>                            hideseconds=3D"true">
>=20
>=20
> I'm having problems where the control doesn't seem to be updating
> correctly.=20

Try something like this:

onchange=3D"var picker=3Dthis; 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
0
Igor
6/2/2010 8:09:48 PM
Igor Tandetnik wrote:

>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.
0
Neil
6/2/2010 8:21:43 PM
Reply:

Similar Artilces:

preserving the layout of text input via text input control
Ok what I want to do is, when using the text input control all cr, lf, crlf and spaces are preserved when the content is input in a db and that the information/layout is preserved when viewing it in a text input filed or grid control.any ideas   jim When you input text via a multiline textbox and insert it into a database your specified line breaks will be maintained. When retrieving the record, you will need to do a replace on the string in order to interpret these line breaks in your html:myField.Replace("\n", "<br />")Does this answer your q...

Fix broken text wrapping and control input text length in TextBox control
Hi! I'm developing a(nother; it's my second!) ASP.NET application that right now is giving me fits. On one of my screens, the user needs to be able to enter large amounts of text into three database fields. The database fields are all char(350). I'm having two problems with this. First of all, I found that when editing an existing record, text in the fields would wrap in a manner similar to this: Wow, what a sorryperformance! The text box is much wider than the text "Wow, what a sorry", so I couldn't figure out why the text was wrapping. I tried setting the Columns property to 90 (which...

superreview requested: [Bug 394792] Only bother updating text input commands for focused text inputs
Boris Zbarsky (gone 9/4-9/11 and 9/14-9/17) <bzbarsky@mit.edu> has asked neil@parkwaycc.co.uk <neil@httl.net> for superreview: Bug 394792: Only bother updating text input commands for focused text inputs https://bugzilla.mozilla.org/show_bug.cgi?id=394792 Attachment 280807: Like so https://bugzilla.mozilla.org/attachment.cgi?id=280807&action=edit ------- Additional Comments from Boris Zbarsky (gone 9/4-9/11 and 9/14-9/17) <bzbarsky@mit.edu> It's not an issue for undo, because we're not an editor listener unless we're focused. ...

superreview granted: [Bug 394792] [FIX] Only bother updating text input commands for focused text inputs
neil@parkwaycc.co.uk <neil@httl.net> has granted Boris Zbarsky (gone 9/4-9/11 and 9/14-9/17) <bzbarsky@mit.edu>'s request for superreview: Bug 394792: [FIX]Only bother updating text input commands for focused text inputs https://bugzilla.mozilla.org/show_bug.cgi?id=394792 Attachment 280807: Like so https://bugzilla.mozilla.org/attachment.cgi?id=280807&action=edit ...

Changing the text of an input (text) control
Hi everyone, please answer the following: I have a html input control as follows  <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords %>" name="newSearch_keywords""/>    When the page loads I need to look at the text of this input field and remove any * chars that are in the text. Thanks for your help <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords.Re...

superreview granted: [Bug 394792] [FIX] Only bother updating text input commands for focused text inputs #2
Robert O'Callahan <roc@ocallahan.org> has granted superreview: Bug 394792: [FIX]Only bother updating text input commands for focused text inputs https://bugzilla.mozilla.org/show_bug.cgi?id=394792 Attachment 280949: With that approach https://bugzilla.mozilla.org/attachment.cgi?id=280949&action=edit ...

unable to input into the input type=text control
i am dynamically creating some controls on the form using javascript in which i have an input control which is text box but when i try to input some thing it is not taking anything what could be wrong. I found that i am populating a Message window n if it is poped the input control is not accepting anything n when it is off it is taking input.  the code for message window is as below can somebody find it out what is wrong in the below code which is preventing me to input text in the input control when it is populated.   MessageWindow = new Window('MessageWindowId'...

text controls, when they change update the total control
I have 4 text field server controls formatted in currency like $1.00 like this one called Mastercard: <td width="130" style="WIDTH: 130px">Mastercard </td> <td width="21" style="WIDTH: 21px"><INPUT onkeypress="return(currencyFormatCents(this,',','.','$',event))" id="Mastercard" type="text" name="Mastercard" runat="server" style="WIDTH: 116px; HEIGHT: 22px" size="14"></td> When This control, or any of the other 4 I want to update a lab...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Which validation control to use to control input textbox text length ?
I have a formview to insert record and I want one field to limit to text char length of 50. Which validation control I should use and how to set it ? ThanksThanks in advance for the help. I will try to credit the ones who helped but most important is we really do sincerely thanks to all who have helped. Check this link.. http://www.codeproject.com/KB/aspnet/Textarea_Length_Validator.aspx Edit: If it is normal single line TextBox, you can set "MaxLength"..Check this code..   <asp:FormView runat="server" ID="formView1" > <...

Setting the height of a Text Input Control on a User Defined Control
I have a user defined control. I am using absolute positioning. I am setting the height and width of a text input using an embedded style. It look fine in the user control window but when I insert the user control onto a page, the heigth of the text control is too large. I cannot seem to control the height on the page I place the user control onto. Any help?Virtually yoursWilliam Main Hi, I think it is better to create the user control to be created as  position = Static to get more layout control of the web user control when used in other pages. For more layout control on all ...

Help me update related controls after a control was updated.
I have nested UserControls on page. What I need to do is to update Profile UserControl after an item was deleted from the list of items. We are using AJAX (ATLAS) in our project. Which principle do I need to use to accomplish that task? How would you do it? Thank you. "A successful person is one who can lay a firm foundation with the bricks that others throw at him." http://www.russiangeek.com/ hello. well, can you explain this a little better?-- Regards,Luis Abreuemail: labreu_at_gmail.comEN blog:http://msmvps.com/blogs/luisabreu Luis Abreu: hello. well...

Who creates /dev/input/mouseX, /dev/input/mice?
Hi, I am struggling with a 3M Microtouch touch screen. The device is being recognized as both /dev/input/mouse0 and /dev/input/event1 which is not appropriate for me. I do not need the touch to be recognized as a mouse. However I was unable to locate the corresponding rules within udev. Who creates the mouseX and mice devices in Suse (10.2)? Thanks -- harsszegi ------------------------------------------------------------------------ I will not try to take away all hope for an answer to your question. But as 10.2 is long out of support, I am afraid almost nob...

chinese character in rich text control and text control
I have a chinese character in either rich text control or text control. The character is look fine if it is a small size (10, 12), however when the font size is changed bigger (36 or 72), the character is out of shape(many dot, not smooth). Is anyone has any idea to print a bigger chinese character from pb7.03. ...

Web resources about - Updating a timepicker control via text input - mozilla.dev.tech.xul

Unanswered 'twitter-bootstrap' Questions - Stack Overflow
current community chat blog Stack Overflow Meta Stack Overflow Stack Overflow Careers your communities Sign up or log in to customize your list. ...

Timetables - Bacchus Marsh Coaches
jQuery Timepicker Addon. Add a timepicker to your jQuery UI Datepicker. With options to show only time, format time, and much more.

pickadate.js / time
$('.timepicker').pickatime({ // Escape any “ rule ” characters with an exclamation mark (!). format: 'T!ime selected: h:i a', formatLabel: ' ...

40个Bootstrap的扩展和插件集合
设计创意1984是一个关于创意设计,设计,插画,艺术摄影,lomo,素材,教程,web,灵感来源,平面设计欣赏的综合性网站。站点每日更新原创文章,为设计师提供优美高品质图片和创意灵感来源。

Autodesk Fusion 360
Join us at the Autodesk Fusion 360 Community Hub Beta!

Autodesk Project Memento
Join us at the Autodesk Project Memento Community!

Index - Videos - DMXzone.COM
DMXzone.com the place for all Web Designers and Developers using Dreamweaver! Here you can find tutorials, Dreamweaver extensions, plug-ins, ...

Calendar Date Picker
A WordPress calendar date picker plugin that uses jQuery UI datepicker & timepicker for future published posts.

DefinitelyTyped/DefinitelyTyped · GitHub
DefinitelyTyped - The repository for high quality TypeScript type definitions.

5 AngularJS Frameworks to Get Apps Up and Running Quickly - Hongkiat
Now that you are well-versed in the basics, it is time to get started on building your own web application with AngularJS. AngularJS made building ...

Resources last updated: 12/15/2015 2:57:39 PM