Associate "Enter" key with a button

Hello,
We have forms which a user fills in and then hits a button to get the result in report.
I know that on text items you can set "Submit when enter pressed ", but forms contain date pickers, select lists etc.
So, I was wondering if there is anyway I can associate "Enter" key with a button request.
Thanks in advance for all replies

Hi,
If you add below to page JavaScript your page is submitted when you hit enter
apex.jQuery(document).keydown(function(evt){
if($f_Enter(evt)){
  doSubmit("BUTTON_REQUEST");
  return false;
return true;
});Change BUTTON_REQUEST accordingly
Regards,
Jari

Similar Messages

  • Associate the comment with the button

    hello experts:
    I have a problem:  do you know how to associate the comment with the button. In Selection Screen, the FOR FIELD is used to associate the comment with the PARAMETERS and SELECT-OPTIONS, but it doesn't work for button.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.
    SELECTION-SCREEN COMMENT 1(30) text-802 y07 MODIF ID y97.
    SELECTION-SCREEN END OF LINE.
    wrong:
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 31(57) butt USER-COMMAND rfsh MODIF ID y07.
    SELECTION-SCREEN COMMENT 1(30) text-802 for field y07 MODIF ID y97.
    SELECTION-SCREEN END OF LINE.
    Thanks in advance.
    Bob

    SELECTION-SCREEN COMMENT [/]<pos(len)> <comm> FOR FIELD <f>
    MODIF ID <key>.
    This statement writes the <comm> comment on the selection screen. For <comm>, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length <len>. The field must be filled before the selection screen is called. You must always specify the <pos(len)> addition. Only if there are several elements in one line, can you omit <pos>.
    The text <comm> will be displayed, starting in column <pos>, for a length of <len>. If you do not use a slash (/), the comment is written into the current line; otherwise a new line is created.
    You use FOR FIELD <f> to assign a field label to the comment. <f> can be the name of a parameter or a selection criterion. As a result, if the user requests help on the comment on the selection screen, the help text for the assigned field <f> is displayed.
    The MODIF ID <key> addition has the same function as for the PARAMETERS statement. You can use it to modify the comment before the selection screen is called.
    Check the Example
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 10(20) TEXT-001 FOR FIELD PARM.
    SELECTION-SCREEN POSITION POS_LOW.
    PARAMETERS PARM LIKE SAPLANE-PLANETYPE.
    SELECTION-SCREEN END OF LINE.
    Kanagaraja L

  • Clearing the history causes the enter key and search button not to work

    If I clear my history and set my browser to never remember or suggest websites, the search button doesn't work. I can click on it but nothing happens. In addition, if I simply use the enter key from my keyboard, that doesn't work either. I have to reset firefox and then the new version will work (but if I go back and change all my history settings again and then it stops working). Please help.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • 'ENTER' key for Submit Button

    Hi,
    I have 1 inputfield , 1 dropdown and 1 submit button in a page. I want to execute submit button always when you click 'ENTER'.
    Now when i click enter from inputField it process something and in background there is no event triggered.But from dropdownbox nothing happens when i click 'ENTER' key.
    Is there any way to assigne 'ENTER' key to the submit button(<htmlb:button) always?
    Thanks in advance
    AP

    Hi,
      It looks like SubmitOnEnter is not available in my verions of htmlb. I just looked into some javacode,
    I have 2 page, Initial and Report,
    Initial page has the code,
    <script>
    document.onkeydown=function(){
    if(event.keyCode==13){document.forms.initial.submit()}}
    </script>
        <htmlb:form id     = "initial"
                    method = "post"
                    action = "Report.htm" >\
          <htmlb:inputField id            = "TranNumber"
                            type          = "string"
                            value         = "<%= INIT-TranNumber %>" />
          <htmlb:button id      = "SUBMITVALUES"
                        text    = "EXECUTE"
                        onClick = "HandleSubmit" />
    </htmlb:form>
    Report page captures it as,
    CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
    IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
      DATA: EVENT TYPE REF TO CL_HTMLB_EVENT.
      EVENT = CL_HTMLB_MANAGER=>GET_EVENT( runtime->server->request ).
      IF EVENT IS NOT INITIAL.
        CASE EVENT->ID.
          WHEN 'SUBMITVALUES'.
            DATA: TranNumber TYPE REF TO CL_HTMLB_INPUTFIELD.
             TranNumber ?= CL_HTMLB_MANAGER=>GET_DATA(
                          request = runtime->server->request
                          name    = 'inputField'
                          id      = 'TranNumber').
        ENDCASE.
      ENDIF.
    ENDIF.
    Basically the no event is not fired. so it is not coming into the Case.
    How to handle this?
    Thank you
    AP

  • How can I associate an ActionListener with a specific button

    I modified the code a lot. Everything works except that it does not associate the actionListener with the button. It will do the action when the window is minimized or maximized, but not when the button is clicked.
    //July 2, 2011
    //Multiplication Tables
    import java.applet.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MultTables extends JApplet implements ActionListener
         //Create Variables for Multiplication Problems
         int factorX = 1;
         int factorY = 1;
         int productZ = 1;
         int productReply;
         //Create the TextField
              JTextField answer = new JTextField(10);
         //Create Labels and buttons
              JLabel productZLabel = new JLabel(factorX + " * " + factorY + " = ");
              JButton checkAnswer = new JButton("Check Answer");
         //Create a container
              Container con = getContentPane();
              FlowLayout flow = new FlowLayout();
         public void init()
              //What goes init? What needs to be added to the interface?
              con.setLayout(flow);
              //Add Components and create interface
              con.add(productZLabel);
              con.add(answer);
              con.add(checkAnswer);
              //Add ActionListener to button
              checkAnswer.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              productZ = factorX * factorY;
              String productReplyString = (answer.getText());
              productReply = (Integer.valueOf(productReplyString));
              for(int sub = 1; sub <= 9; ++sub);
              if (productReply == productZ)
                   JLabel correct = new JLabel("That is correct!");
                   con.remove(productZLabel);
                   con.remove(answer);
                   con.remove(checkAnswer);
                   con.add(correct);
                   ++factorX;
              else
                   JLabel incorrect = new JLabel("The correct answer is " + productZ);
                   con.remove(productZLabel);
                   con.remove(answer);
                   con.remove(checkAnswer);
                   con.add(incorrect);
                   ++factorX;
    }

    EJP wrote:
    Are you sure you're running that code? It should work. ActionListeners don't respond to min/max events.Yup. But the repaint triggered by resizing updates the display.
    db

  • Apple, why did you change my Keyboard and remove the enter key?

    Hi all,
    I had my new black MacBook delivered just before Christmas. The keyboard has changed from my previous Black MacBook (the one a colleague poured wine over and killed... grrr).
    Apple have changed the look of the command key and removed the Apple logo (very sad), but more frustratingly have replaced the 'enter' key with another 'option' key.
    I found the 'enter' key really useful, especially for pull down menu and really miss having one.
    Does anyone know if there is a way to assign the new 'option' key to be an 'enter' key?
    Cheers
    Scott.

    I just received a new(refub) MacBook 2.2GHz today and was very disappointed to find the enter key missing. After selling my G4 PowerBook six months ago, I was so looking forward to having the convenience of being able to slap the enter key for dialog boxes with and submitting forms without having to move my hand from the trackpad. I hope that someone will come up with a way to replace the functionality of the missing enter key.
    Which brings me to my next point- There has been a big oversight in the implementation of the MacBook's replacement of the Enter Key, which is to use the FN+Return keys. It seems that when using the FN key with the Return key, the system will ignore the Command key being invoked. I discovered this very quickly. Anyone who uses Apple Remote Desktop knows that in order to send a Unix command to a remote machine, you type the command in the 'send UNIX command' window, then hit Command+Enter to send the command. Return produces a carriage return, FN+Return does nothing, and FNCommandReturn does nothing. The only current work around is to use the track pad to the "Send" button and click, which really slows things down.

  • Associating two events with submit button using  javascript in jsp

    Hi
    How can i Associate two events with submit button using javascript in jsp. Firstly it should insert the data to database and secondly it should close the same pop-up window

    Have something like :
    <input type="submit" name="submitbtn" value="Click me" onClick="function1(); function2(); " />
    You just call both functions sequentially, it's that simple. Although using javascript to work with a database, that seems a bit tricky.

  • Enter Key in a Tree!!

    Hi,
    i have a JTree and the nodes of this tree can be removed, edited and viewed. I have assigned the double clik of the mouse in a node with the modification action, but know i also want to assign the pressing of the ENTER key with this action. Can anyone tell how to do it. I believe it has something to do with changing the ActionMap of the JTree. Because i am short of time, if someone could post some code i would apreciate.
    Thanks in advance

    no need to answer...done it

  • Enable enter key

    How to enable enter key in adobe flex builder 2

    An easy way to enable the enter key for all buttons (when
    they have the focus)
    is to
    - on each button add a click event handler that does what
    the button needs to do
    - Just add a keyDown Handler to the component that contains
    the buttons
    - In the key down handler check for the enter key, and if the
    target is a button.
    If so then dispatch a button click event.
    In the code below if the user tabs to a button and presses
    enter
    the button will be clicked.
    See below
    private function handleKeyDown(event:KeyboardEvent):void
    var char:uint = event.keyCode;
    var enterChar:uint = 13;
    var tabChar:uint = 9;
    var pgUp:uint = 33;
    var pgDown:uint = 34;
    if(char == enterChar)
    if(event.target is Button)
    var bt:Button = event.target as Button;
    if(bt.enabled == false || bt.visible == false)
    return;
    var c:MouseEvent = new MouseEvent(MouseEvent.CLICK,true);
    bt.dispatchEvent(c);
    return;

  • How to activate a button with Enter key?

    Hi
    I was certain that in AC3 this is done by default, when the button is in focus and the ENTER key is press, it dispatches a Click event.. but it doesn´t work, am I missing something?? Thanks for your help.
    myButon.addEventListener("click", funClick);
    function funClick(evtObj:Event):void {
    trace("yes");

    if you have btnNum buttons with names btn1, btn2,... and they each have a listener function f1(), f2(), ...  you can use the following to code for them all and the enter key:
    var btnNum:uint=2;
    for(var i:uint=1;i<=btnNum;i++){
        this["btn"+i].addEventListener("click", this["f"+i]);
        this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER,overF);
        this["btn"+i].addEventListener(MouseEvent.MOUSE_OUT,outF);
    stage.addEventListener(KeyboardEvent.KEY_DOWN,f);
    function overF(e:MouseEvent){
        stage.focus = InteractiveObject(e.currentTarget);
    function outF(e:MouseEvent){
        stage.focus = null;
    function f(evtObj:KeyboardEvent):void {
        if(KeyboardEvent(evtObj).keyCode==13 && stage.focus != null){
            stage.focus.dispatchEvent(new Event("click"));
    // define your f1(), f2() etc functions

  • JFileChooser - activating buttons with the enter key

    Hi All,
    I am trying to figure out how to activate the cancel button in the file chooser by tabbing to it, and than pressing the enter key. I know how to do this in a regular dialog, but I can't seem to get the access I need to the JFileChooser to get it to work there.
    I would appreciate any help.
    Thanks!
    robinste

    The Buttons in the File Chooser by default dont use the Enter Key.
    You must make the Enter key work if you are to use it
    after you tab to get the focus on to it.
    For this to be done you will need to extend the FileChooser
    and change the key listener for the cancel button .......
    Hope t was of some help ............

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Problem with Enter key and JOptionPane in 1.4

    Hi,
    I had a problem with an application I was working on.
    In this application, pressing [Enter] anywhere within the focused window would submit the information entered into the form that was contained within the frame.
    The application would then try to validate the data. If it was found to be invalid, it would pop up a JOptionPane informing the user of that fact.
    By default, pressing [Enter] when a JOptionPane is up will activate the focused button (in most cases, the [OK] button) thus dismissing the dialog.
    In JDK 1.3 this worked fine. But in JDK 1.4, this has the result of dismissing the dialog and opping it up again. This is because the [Enter] key still works on the frame behind the JOptionPane and thus tries to validate it again, which results in another invalid dialog msg popping up.
    The only way to get out is to use the mouse or the Esc key.
    Now, in the application I put in a workaround that I was not very happy with. So, to make sure it wasn't the application itself, I created a test which demonstrates that it still misbehaves.
    Here it is.
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.KeyStroke;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.WindowConstants;
    * @author avromf
    public class FocusProblemTest extends AbstractAction
         private static JFrame frame;
         public FocusProblemTest()
              super();
              putValue(NAME, "Test");
         public void actionPerformed(ActionEvent e)
              JOptionPane.showMessageDialog(frame, "This is a test.");
         public static void main(String[] args)
              FocusProblemTest action= new FocusProblemTest();
              try
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception e)
                   e.printStackTrace();
              frame= new JFrame("Test");
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              Container contents= frame.getContentPane();
              contents.setLayout(new FlowLayout());
              JTextField field= new JTextField("Test");
              field.setColumns(30);
              JButton  button= new JButton(action);
              KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true);
              button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(enterKey, "test");
              button.getActionMap().put("test", action);
              contents.add(field);
              contents.add(button);
              frame.pack();
              frame.setVisible(true);
    }Does anyone have any solution to this problem?

    I know that focus management has changed alot.
    Based on my experimentation a while back, in 1.4 it still believes that the JFrame is the window in focus, even though a JOptionPane is currently in front of it (unless I misinterpreted what was going on). Thus, the frame seems to get the keyboard event and re-invoke the action.
    A.F.

  • Submit a Form in IE with Enter key.

    Hi all,
    I have a Form with a Get attribute, a textfield and a search
    (submit) button.
    When I press the Enter key in my keyboard, the form is not
    submited in I.E. (i'm using IE 7).
    When I click the button with the mouse, it works.
    In Firefox, all (keyboard and mouse) works.
    How can we workaround this issue?
    Thanks

    oicram wrote:
    > Please, I need an answer here. I have deeply search over
    the internet and I only found something about .js or hidden fields,
    but its all vague...
    http://www.webreference.com/programming/java_dhtml/chap8/2/2.html
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Enter key instead of clicking on the button

    Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
    Hi,
    I have input text and a submit button. After I made my entry in the input text I want to press the Enter key and the action is executed.
    How can i do it??
    best regards

    We can use ADF component with out using ADF form.
    Sample
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
    <af:panelGroupLayout id="pgl1">
    <af:inputText label="Created User" id="itCreatedUser"
    binding="#{pageFlowScope.historyBean.itCreatedUser}"/>
    <af:commandButton text="Search" id="cbSearch" action="userDetails"
    actionListener="#{pageFlowScope.historyBean.cbSearchAL}"/>
    <af:inputText label="Label 1" id="it1"/>
    </af:panelGroupLayout>
    </jsp:root>
    Edited by: sameera.sac on Jun 29, 2011 4:33 PM

Maybe you are looking for

  • How do i display duplicate files in itunes 11?

    hi, does anyone know how to display my duplicate songs in itunes 11 please?

  • Can't repair or reset Keychain in OSX 10.10? What to do?

    I'm having a problem with a user who just migrated to a new MacBook Air with OSX 10.10 installed, but something went wrong with his keychain during the migration.  It now won't store any new passwords, even passwords for WI-FI networks, so he has to

  • WebProxy Not Rewriting content

    Hi all, I have Web Proxy 4.0.3 in a Solaris 10 SPARC box. WebProxy is operating in reverse mode. I have set rewrite-content-location to true in obj.conf and also made a Content rewrite filter. When the webproxy (www.external.com) fecthes content from

  • Saturation disappears upon render

    Hello, Just started using Lightroom and it seems I've hit my first problem I can't find an answer to. I took a few shots today with my 50d with a higher saturation using the Landscape setting.  Now, the saturation appears in the LCD on the camera fin

  • Window movement between two monitors

    Hello there. I'm not sure if this question would be under Swing section or not... this is the best section I could match my problem with. - I use two monitors on my computer - Windows XP operating system - JRE 1.6.0_16 - EIZO FlexScan L768 Monitors W