Hello folks,
following on to a in issue I had earlier, I am still struggling with my form. Issue is the following. I have a form, where a textbox is linked to a datefield. I want to be able to enter a time into this field both in the hh:nn and alternative also in the hhnn format or be able to enter 09:00 as 9 and that's it. I figured, I had to enter the text, and capture it, before it is actually committed to the value of the underlying control (or something like that) and then manipulate the text input to a correct time format and commit that one to the field then.
Problem is, I don't know, which event to use:
the change event fires for every character entered (I don't want that, I want it to fire after I have entered 0900 completely.
the beforeupdate event might fire before the date is saved to the database. Still, it checks, whether I entered a correct date/time format which '9' for example is not.
So question: which event to use, or alternatively: how to detect in the change event, that the last one I entered indicates, I'm done with the input?
I have thought of an alternative solution, which doesn't work neither..... grrr. since the up/down arrow keys in a continuous form (oh: did I mention, I am in a cont form?) which are doing the same currently as the left/right arrows (i.e. move to the next tab) to increment/decrement a time field by 15 mins, so I dont have to enter time manually... Now, this works, but I can't get rid of the original function of the up/down key (which is to move to the next tab): so triggering the keypress event and checking for code 38/40 (key up/down) it adds 15 mins (wow!). However it then moves on to the next tab (which is not what i want, since I want to add more increments). Well, I thought setfocus back to the control I'm coming from might help. well it doesn't. somehow it doesn't let me set the focus back on the control, from which the event had triggered. Moving it deliberately to another control and then back, doesn't help neither.
Any solution to either or both of the problems?
many thanks
Jan
following on to a in issue I had earlier, I am still struggling with my form. Issue is the following. I have a form, where a textbox is linked to a datefield. I want to be able to enter a time into this field both in the hh:nn and alternative also in the hhnn format or be able to enter 09:00 as 9 and that's it. I figured, I had to enter the text, and capture it, before it is actually committed to the value of the underlying control (or something like that) and then manipulate the text input to a correct time format and commit that one to the field then.
Problem is, I don't know, which event to use:
the change event fires for every character entered (I don't want that, I want it to fire after I have entered 0900 completely.
the beforeupdate event might fire before the date is saved to the database. Still, it checks, whether I entered a correct date/time format which '9' for example is not.
So question: which event to use, or alternatively: how to detect in the change event, that the last one I entered indicates, I'm done with the input?
I have thought of an alternative solution, which doesn't work neither..... grrr. since the up/down arrow keys in a continuous form (oh: did I mention, I am in a cont form?) which are doing the same currently as the left/right arrows (i.e. move to the next tab) to increment/decrement a time field by 15 mins, so I dont have to enter time manually... Now, this works, but I can't get rid of the original function of the up/down key (which is to move to the next tab): so triggering the keypress event and checking for code 38/40 (key up/down) it adds 15 mins (wow!). However it then moves on to the next tab (which is not what i want, since I want to add more increments). Well, I thought setfocus back to the control I'm coming from might help. well it doesn't. somehow it doesn't let me set the focus back on the control, from which the event had triggered. Moving it deliberately to another control and then back, doesn't help neither.
Any solution to either or both of the problems?
many thanks
Jan