Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment   Page 1 of 2      1   2   Next
Spliter

Member
Registered:
Posts: 30
Reply with quote  #1 
Hi!!
How I can do?? I want...when I input a value in edit field and then press Enter, then some button works or some function....




0
sleclerc

Avatar / Picture

Senior Veteran
Registered:
Posts: 365
Reply with quote  #2 

You can do it by creating an event handler for the "key up" event of the field in either JavaScript or VBScript.  In that event handler you would check the keycode associated with the event, and if it was the "enter" key you would perform your desired action (button click, tab to another field, etc...)


__________________
Scott

US Navy Seals --> "The only easy day was yesterday"
0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #3 
What's the event name? For examle in my e-work integration wizard i have only two optiens OnFocus and OnExit...but...what i should write for this key up and how i can send to the function key, that i pressed?
0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #4 
I tried onKeyPress i tried onKeyUp...nothing.... :(
For example i wrote
on Client Extensions

 onKeyPress=isAlphanumeric ()&Language=JScript

and script is
 function isAlphanumeric (fldData)
{
  alert("You can only enter letters or numbers in this field!");
}
0
sleclerc

Avatar / Picture

Senior Veteran
Registered:
Posts: 365
Reply with quote  #5 

I do it in 3 steps.

 

1. I create a JavaScript function called "modifyFormOnLoad" and call this function using the Integration Wizard's Form's Load event.

2. In the "modify FormOnLoad" function I redirect the standard "keyup" event handler to my custom event handler like this:

Quote:

// first I create a global variable to hold a pointer to the original "keyup" handler

var oldOrigAttnyPercent_keyUp;

 

function modifyFormOnLoad()

{

    // the field I want to catch is called OrigAttnyPercent

 

    // save a pointer to the original keyup event handler

    oldOrigAttnyPercent_keyUp = document.getElementById("OrigAttnyPercent").onkeyup;

 

    // change the keyup event handler to my custom handler
    document.getElementById("OrigAttnyPercent").onkeyup = OrigAttnyPercent_changed;
}

 

 

function OrigAttnyPercent_changed()

{

 

    // do something here

 

    // IMPORTANT

    // execute the original handler here so that standard functionality is executed (unless you are positive it is not necessary)

    oldOrigAttnyPercent_keyUp();

}

 


__________________
Scott

US Navy Seals --> "The only easy day was yesterday"
0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #6 
Ok! Thank you! :)
Something start working...just need that function works only by pressing enter...i will trying some things....

0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #7 
eh..HELP me...i will shoot myself...


function modifyFormOnLoad()

{
    oldOrigAttnyPercent_keyUp = document.getElementById("txtEstimatorNameAAA").onkeyup;
    document.getElementById("txtEstimatorNameAAA").onkeypress =checkKey;
}

function checkKey(e)
{
    e = window.event;
    code = e.keycode;
     alert(code);   //returns undefined
    code = e.which;
     alert(code);//returns undefined

    if (code == 13 && start == 0){
        alert(code);
    }
    else {
        alert("ELSE"); ////returns ELSE
    }

}
This is most used example that i fund in google


HOW I CAN GET THE KEY, THAT I PRESSED???? I siitting at this problem haf day...asking for help google...tried so many ways...but nothing...this piiiii e-work returns notnig.

0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #8 
I'm not au fait with this, but isn't there a mix of onkeyup and onkeypress in there? I'm sure that will cause some problems, but not sure what.


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #9 
oi...sorry....this row (oldOrigAttnyPercent_keyUp = document.getElementById("txtEstimatorNameAAA").onkeyup;) is not obligatory

So i think that is not problem..i tried with onkeyup, dokeyup, onkeypress...nothing..

0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #10 
jabadabadaba duuu!!!!!

function modifyFormOnLoad()

{
    document.getElementById("txtEstimatorNameAAA").onkeyup = =function(){
        alert(window.event.keyCode);
    }
}
Now it is working!!

0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #11 
I am really glad it's going, but can I clarifythe "= =" (note the space). Is this really the way it is? That is not what you may expect, so the underlying cause of it working is difficult to work out.

Sorry to be pedantic, but it will almost certainly help someone someday if this is cleared up (and I think that may be me....)


__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Spliter

Member
Registered:
Posts: 30
Reply with quote  #12 
Oh soryyyy...sorrry sooooryyyy !!!!

This isn't right....it should be without two "=" only one.....Jerome you are right!!!
0
chris1010

Member
Registered:
Posts: 25
Reply with quote  #13 
perhaps a bit late, but for other guys who want to use this.
The checkKey(e) - Method is correct. But the failure is in the following line:

code = e.keycode;

correct is:

code = e.keyCode;

Javascript is case sensitive ;)
So now it works ;)

If you need to call a serverside Button (for example a search Button in an admin form) use the following:

document.getElementById("btnSearch").onfocus();
document.getElementById("btnSearch").onclick();

 
Chris
0
Pete

Senior Veteran
Registered:
Posts: 315
Reply with quote  #14 
Have done this a couple of times now.
Call this on form load:
Quote:
function startFunctions()
{
    document.onkeyup = checkKeyPressed;
}


Here you go doing to click the button or what ever
Quote:

function checkKeyPressed(){
    var pressedKeyCode = event.keyCode;

    if(pressedKeyCode == 13){
        eworkData.FieldByName("btnId").HTMLfield.onfocus();
        eworkData.FieldByName("btnId").HTMLfield.onclick();
    }
}



__________________
If you want the job done right, hire a professional.
0
Rkeeley

Member
Registered:
Posts: 49
Reply with quote  #15 

Looking for some help!  I have executed the code above with no issues on several forms, but I am having issues with the above code when I am trying to execute the above on a form segment.  Any suggestions?!?!?!

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!