Topic
  • 5 replies
  • Latest Post - ‏2012-10-09T06:01:59Z by makvell
dratandeep
dratandeep
20 Posts

Pinned topic Invoke the button after hit enter key from the keyboard

‏2012-10-05T10:30:12Z |
Hi All,
I want to invoke the search button after hitting the enter key from the keyboard.I write javascript code. but getting an error TX_IN_METHOD: WRONG TRANSACTION.
could any one please help me.

<script type="text/javascript">
function searchWithCriteria(){
document.getElementById("ButtonGroup1_Button0").name="ButtonGroup0#Button0";
if(window.event.keyCode == 13){
alert("inside "+ window.event.keyCode);
document.getElementById("ButtonGroup0_Button0").click();
}
}
</script>
thanks in advance.
Updated on 2012-10-09T06:01:59Z at 2012-10-09T06:01:59Z by makvell
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Invoke the button after hit enter key from the keyboard

    ‏2012-10-08T03:05:20Z  
    I believe what is happening that after hit Enter, Lombardi starts processing something based on which button has been triggered on the enter and while it's doing its processing, you try to interrupt by calling another thing so simply Lombardi is answering ("I'm busy with the same transaction"), so you need to find a way to stop the first event to happen (e.g. disable the flow property from the button)
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Invoke the button after hit enter key from the keyboard

    ‏2012-10-08T13:02:18Z  
    I believe what is happening that after hit Enter, Lombardi starts processing something based on which button has been triggered on the enter and while it's doing its processing, you try to interrupt by calling another thing so simply Lombardi is answering ("I'm busy with the same transaction"), so you need to find a way to stop the first event to happen (e.g. disable the flow property from the button)
    Okay, so the coach is an HTML Form. When you hit enter on an HTML form element, I believe it finds the first button or submit element on the form and triggers it. Put an alert in your code and see if the enter key is actually calling your function. I suspect it is calling something else and whatever that is, it isn't one of the forms "Buttons". You could use wireshark or something similar to inspect the post and figure out what it is doing.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • SystemAdmin
    SystemAdmin
    7615 Posts

    Re: Invoke the button after hit enter key from the keyboard

    ‏2012-10-08T13:04:35Z  
    Okay, so the coach is an HTML Form. When you hit enter on an HTML form element, I believe it finds the first button or submit element on the form and triggers it. Put an alert in your code and see if the enter key is actually calling your function. I suspect it is calling something else and whatever that is, it isn't one of the forms "Buttons". You could use wireshark or something similar to inspect the post and figure out what it is doing.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    Oops sorry, you already have the alert. I would still see if you can inspect what is actually being triggered. You also might try calling your method from a custom HTML button. If it works from the button, then you know that it is something around the browser reaction to the enter key that is causing the problem.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
  • dratandeep
    dratandeep
    20 Posts

    Re: Invoke the button after hit enter key from the keyboard

    ‏2012-10-08T16:39:30Z  
    Oops sorry, you already have the alert. I would still see if you can inspect what is actually being triggered. You also might try calling your method from a custom HTML button. If it works from the button, then you know that it is something around the browser reaction to the enter key that is causing the problem.

    Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
    Hi Andrew,

    Thanks for your response, The strange thing is that it's working fine in Offshore(India) but not working in Onshore(USA).Offshore and Onshore team using same browser IE8.
  • makvell
    makvell
    269 Posts

    Re: Invoke the button after hit enter key from the keyboard

    ‏2012-10-09T06:01:59Z  
    Sorry, but I do not understand what the code does. Where is it located?

    
    function searchWithCriteria()
    {
    //  <-- This function is called from ...? document.getElementById(
    "ButtonGroup1_Button0").name=
    "ButtonGroup0#Button0";
    //  <-- What is this line? What should she do? 
    
    if(window.event.keyCode == 13)
    {
    //  <-- There may byt problem in different browsers alert(
    "inside "+ window.event.keyCode); document.getElementById(
    "ButtonGroup0_Button0").click(); 
    } 
    }
    


    To answer your question needs more information.