April 18, 2008, 04:41 AM
jbond007Maintain
How do you set the enter key on the key pad as
a tab key in maintain. Most of our users uses the enter key as the tab key. However, in the apps that was developed the enter key is the tab key. I know in modify you can change the settings. Can this also be done in maintain.
Thanks,
Jd
7.61, nt
Output: excel, pdf, html,
April 18, 2008, 06:48 AM
hammo1jYou should have listened to what "Q" was telling you.
It was in his briefing.
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
April 18, 2008, 08:42 AM
Maintain WizardOk - This is pretty straight forward, but it's also brute force. If anyone has a different way, let us know.
Basically, if checks to see if the ENTER key is pressed (13), checks the current field position, and moves the cursor to the next field. Please this trigger on the form itself
Mark
function OnForm1_KeyPress ( ) {
var kp = window.event.keyCode;
var curr = document.activeElement.id;
if (kp==13)
{
if (curr=='Field1_Edit')
document.Form1.Field2_Edit.focus();
if (curr=='Field2_Edit')
document.Form1.Field3_Edit.focus();
if (curr=='Field3_Edit')
document.Form1.Field1_Edit.focus();
}
}
April 18, 2008, 01:09 PM
Alan BI've found this to work, particularly where there are many elements on the page.
function KeyPress ( ) {
// change minTabIndex and maxTabindex to the first and last input/editable elements on the form
var minTabIndex=1;
var maxTabIndex=5;
var kp = window.event.keyCode;
if (kp != 13) return;
var currentTabIndex = window.event.srcElement.getAttribute('tabindex');
var numElements = document.forms[0].length;
nextElement = document.forms[0].elements[0];
var minElement = ' ';
var maxElement = ' ';
var nextElement = ' ';
var currElement = ' ';
for(elementnum = 0; elementnum < numElements; elementnum++){
if (document.forms[0].elements[elementnum].getAttribute('tabindex') == minTabIndex) {
minElement = elementnum;
}
if (document.forms[0].elements[elementnum].getAttribute('tabindex') == currentTabIndex) {
currElement = elementnum;
}
if (document.forms[0].elements[elementnum].getAttribute('tabindex') == maxTabIndex) {
maxElement = elementnum;
break
}
if (document.forms[0].elements[elementnum].getAttribute('tabindex') > currentTabIndex) {
nextElement = elementnum;
break
}
}
if (maxElement == currElement) {
document.forms[0].elements[minElement].focus();
return;
} else {
if (nextElement == ' ') {
document.forms[0].elements[maxElement].focus();
return;
} else {
document.forms[0].elements[nextElement].focus();
return;
}
}
}
if(document.captureEvents) document.captureEvents(Event.KEYPRESS);
document.onkeypress = KeyPress;
Make sure your tab order is set up, and then set the minTabIndex and maxTabIndex. Put this code in a .js file and attach it to your form.
If you have an issue with this, come back to me 'cos I know how I set up the maintain forms, so have not tried it with the way others might do it differently, or you may want a bit more explanation.
Alan.
WF 7.705/8.007
April 28, 2008, 04:58 PM
jbond007alan,
I am not a maintain person at all. I don't know how to add this to the maintain app.
HELP
jbond007
7.61, nt
Output: excel, pdf, html,
April 28, 2008, 07:41 PM
Dave Ayersquote:
Most of our users uses the enter key as the tab key.
You would be better off to train the users to use the Tab key as it is intended. I can't see where their current behavior is of any value in todays IS/IT world.
On most any web page with a form, the Enter key will submit the form. If you remap the function of the Enter key, you are just reinforcing bad user interface behavior, that will cause them grief down the road.
And, you won't have to figure out how to add Alan's Javascript to your Maintain
April 29, 2008, 09:21 AM
Maintain WizardBoth techniques need to be set up as javascript triggers. If you use my technique do this:
1) Display the form in question
2) Click on the Trigger Tab
3) Select the KeyPress trigger
4) Change trigger type to JavaScript and include my trigger code.
You will have to change the names of my objects to reflect the name of your objects.
Mark