Focal Point
(Solved) automatically tabbing to next field on maintain form

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/647102432

September 09, 2009, 09:38 AM
trishH
(Solved) automatically tabbing to next field on maintain form
is there a function in maintain to automatically tab to the next field if the previous field is filled to its maximum?

i found javascript that describes a way to do this but i thought there might be something similar in maintain.

thanks, trish

webfocus 7.6.8 windows
maintain, mre, reportcaster,

This message has been edited. Last edited by: trishH,


webfocus 7.703, windows, pdf,excel,html
September 09, 2009, 10:17 AM
Maintain Wizard
Hi Trish
Maintain does not have a default function to do this. However it is pretty easy to do with JavaScript.

Basically you can add this code to a JS file and embed it on your form. In this case it checks the input length of the data in EditBox1 and if it is greater than 2, autotabs to Editbox2. You will need to create a block of code for each editbox.

Mark

// Used in JavaScript Script library
// Limits input to 3 characters in Edit Boxes. After 3rd character is entered automatically set focus to
// next control
document.onkeyup = OnKeyUp;
function OnKeyUp()
{
if (document.Form1.EditBox1.value.length > 2))
{
var x = String(document.Form1.EditBox1.value).substr(0,3);
document.Form1.EditBox1.value = x;
document.Form1.EditBox2.focus();
}
}
September 09, 2009, 10:18 AM
GamP
Trish,
I do not know of thing like that to be standard present in maintain. As you found there is javascript that can do this, and you'll have to incorporate this bit of javascript yourself in the maintain.
This may be one of those new-feature-requests Mark is asking for - why not mention it to him in his thread ... who knows, it may become a included into the next release....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 09, 2009, 01:32 PM
trishH
thanks Mark i will try that. i know how to embed the javascript. do i activate it as an event handler on "change"? for the field


webfocus 7.703, windows, pdf,excel,html
September 09, 2009, 02:37 PM
Maintain Wizard
Trish
To do this, create a js file, I called mine AUTOTAB.JS and include it in the application path. Include the JS code in the example. Add that file to the project in the desktop.

Then, in the MDE, display the form that is going to use the function. Set your screen so you can also see the AUTOTAB.JS file from the desktop. Now drag the JS file onto an empty area of the form. You will be asked to embed or link the JS file. Embed it.

This function will now automatically be called every time a key is pressed but will only fire when the condition is met. You don't have to link it to a trigger.

One thing. I notice a small typo. There should be only one closing paren on the IF line, not two:

// Used in JavaScript Script library
// Limits input to 3 characters in Edit Boxes. After 3rd character is entered automatically set focus to
// next control
document.onkeyup = OnKeyUp;
function OnKeyUp()
{
if (document.Form1.EditBox1.value.length > 2)
{
var x = String(document.Form1.EditBox1.value).substr(0,3);
document.Form1.EditBox1.value = x;
document.Form1.EditBox2.focus();
}
}

Mark