A catalog client Script that is triggered on second keydown, is this possible?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 07:59 AM
Basically, I am trying to move the cursor to next field; once first field is populated.
Then, I want to move to third field when second field populated, and so on.
I can achieve this with an onLoad script for the first field but not subsequent fields.
The first script works fine for detecting the first keydown.
But, second script below does not.
Can keydown be used in an onChange Client script?
(or does the system wait until user clicks out of the field)
(or does the system wait until user clicks out of the field)
Can a second keydown be detected?
(then I could use an onLoad script...)
(then I could use an onLoad script...)
Any ideas out there?
Thanks for your time,
Lon
Lon
Example #1
function onLoad() {
//Get control of field to identify keyup event, then pause for 1/10 of a second
var control = g_form.getControl('first_asset_tag');
control.onkeyup = nextField;
window.setTimeout(nextField,100);
//Move cursor to next field
function nextField(){
g_form.getControl('first_serial_number').focus();
}
}
Example 2
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Get control of field to identify keyup event, then pause for 1/10 of a second
var control1 = g_form.getControl('first_serial_number');
control1.onkeyup = nextField1;
window.setTimeout(nextField1,100);
function nextField1(){
//Move cursor to next field
g_form.getControl('first_mac_address').focus();
}
}
0 REPLIES 0