Focal Point
Maintain AutoTab

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

June 04, 2004, 09:32 AM
<ejaf>
Maintain AutoTab
I am developing a maintain application and have some data entry screens where the user will be entering data at high speed.

The user want to be able to enter data in one maintain form field and once the field is completed they want the cursor to be placed in the next field, etc. etc. (They do not want to TAB!). I can do this in JAVASCRIPT with a combination of OnKeyUp and AutoTab, but can't get this to work in MAINTAIN.

Has anybody managed to create this behaviour within a Maintain application.

Thanks,
Paul.
June 04, 2004, 02:36 PM
Maintain Wizard
The best way to accomplish this is to create a Javascript library and attach it to your form. What the library does, is check the current field and the maximum length that you have set. When the user has entered the data, it autotabs to the field that you set.

In this example, when the user enters a 5th character into the Moviecode field, the cursor is placed in the Title field. When he enters the 10 character into the Title field, the cursor goes to the Category field.

Place all of the fields, their lengths and tab order in this one file.

Please note, that in the below example, I enter OnKeyUp as OnKey_Up. I could not enter it without the underscore! Please remove it when you use the code!

Good luck!
Mark


// Used in JavaScript Script library
// Limits input to n characters in Edit Boxes. After nth character is entered automatically set focus to next control


document.onkey_up = OnKeyUp;
function OnKeyUp()
{
var CurrentControl = document.activeElement.id;
var Box1Len = document.Form1.Moviecode_Edit.value.length;
var Box2Len = document.Form1.Title_Edit.value.length;

if ((CurrentControl == "Moviecode_Edit") && (Box1Len > 4))
{
var x = String(document.Form1.Moviecode_Edit.value).substr(0,5);
document.Form1.Moviecode_Edit.value = x;
document.Form1.Title_Edit.focus();
}
else if ((CurrentControl == "Title_Edit") && (Box2Len > 9))
{
var y = String(document.Form1.Title_Edit.value).substr(0,10);
document.Form1.Title_Edit.value = y;
document.Form1.Category_Edit.focus();
}
}