Behavior when typing 'Enter' in h:inputText

I am seeing the following behavior:
When a user types the 'Enter' key when a h:inputText has focus, the page seems to behave as if the user clicked the first button added to the page. (In my case this is a 'Cancel' button that clears data and causes navigation to another page. Many users are used to hitting 'Enter' when the have finished inputting text - so the 'Cancel' behavior would not be a pleasant suprise.)
My questions are:
1) Is this supposed to happen when 'Enter' is typed in a h:inputText?
2) Can I change this and how?
3) I would like it so hitting 'Enter' does nothing (better would be to move to the next h:inputText) Can this be done and how?
Any info regarding these specific questions or generally how key interactions work with jsf/Creator would be appreciated.

You can do this using JavaScript:
Specify the onkeypress of the inputText like this:
                                <h:inputText binding="#{Page1.tfSearchString}" id="tfSearchString" onkeypress="return onEnterSubmit(event);" value="*" valueChangeListener="#{Page1.tfSearchString_processValueChange}"/>The in the head part of your page, add the following javascript:
                var ie4 = false;
                if(document.all) {
                    ie4 = true;
                function onEnterSubmit(event) {
                    if (ie4) {
                        if (window.event && window.event.keyCode == 13) {
                            document.forms['form1']['form1:btnRefresh'].focus();
                            document.forms['form1']['form1:btnRefresh'].click();
                            return false;
                        else
                            return true;
                    else
                        if (event && event.which == 13)
                            document.forms['form1']['form1:btnRefresh'].click();
                        else
                            return true;
                }This assumes you have btnRefresh as the name of the submit button, and you want it clicked on enter key press. Else just comment out the part with the .click()/focus() to prevent any action on Enter key press.
Also, you can focus on any other textField in the page with the enter by replacing the click()/focus lines() with document.forms['form1']['form1:tfName'].focus()

Similar Messages

  • Strange behavior when pressing ENTER in a form page

    Hi there
    Please go to the address:
    http://apex.oracle.com/pls/otn/f?p=20104:4
    If you click the Create button, enter anything in the Name field and press ENTER while in the field, you will be taken back to the main page, the message Action Processed will be displayed, but no data will be inserted. If you click on the Create button though, it works fine.
    Have anyone seen this? Any explanation for it? How to fix it? I could not find any reason for this behavior (the Name field is NOT an always submit page when enter pressed field type).
    (btw the two pages are very simple, based on wizards without any customisation)
    Thanks
    Luis

    i guess, trying the input form, the input text field for Name is an item 'textfield submit on enter'. But what happens is that when enter is pressed no additionally submit information is send, which is the case with buttons. Buttons call the doSubmit('<BUTTONNAME>') javascript function on click, allowing the process to run when thee are set conditionally.
    Carl's answer by setting the process unconditional will also result this action will take place when another buton (without direct redirect) will fire this.).
    So additionally when multple buttons and processes some new javascript kan be used to do the right submit on Enter. Example:
    In Page header, or shared javascript import file create a JS function submitOnEnter
    function submitOnEnter(submit,e){
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13){
    doSubmit(submit);
    return false;
    }else{
    return true;
    Then with you're item you define the js-event onKeyPress to call the function submitOnEnter
    onkeypress="javascript:return submitOnEnter('CREATE',event);"

  • Problem when pressing ENTER for InputText object text

    Hi,
    I encountered a very strane anomly when pressing ENTER for
    InputText object text.
    1) I set the InputText object for having maxium 2 characters.
    2) I set the InputText object for getting only numbers using
    .restrict= "0-9";
    Now, say the InputText is now empty.
    1) Say I press the number "7" - the text line is now
    containing - "7".
    2) Now, I press ENTER - the "7" is cleared from the text
    line.
    Now, while the text box is clear, we think that we can insert
    2 numbers.. but not!
    3) I press a number, say "9" - the line contains "9"
    4) I try to insert another number... but I can't!!
    In order to be able to insert two numbers, I have to press
    twice the Backspace in order to clear the "9" , and another ghost
    note (the ENTER?).
    How can I solve this anomaly?
    Thanks
    Yossi

    Thank you very much! it works.
    (Those tiny anomalies are so annoying, that it is so great
    feeling to have them solved, thanks)

  • When typing in a fillable form, when I enter text on one line it automatically enters it on a previous line. How do I fix this?

    Using fillable forms, there is one question where it asks to enter the date. When I enter the date, it automatically puts it in another place too.  If I delete, it deletes them both!! Help!

    THANK YOU try67===that fixed it...

  • Skipping past a quote when typing property values?

    Hi,
    A GIVEN: In the mxml editor, when one enters in part of a property, e.g. "te" in "text",  FlashBuilder can complete it by hitting the carriage return, and we get text="".  We land between the quotes, and then one can type in value.
    QUESTION: when done typing in the value, how does one get out of the quotes without using the right-arrow key, to enter the next property?   I'm watching a video where I see a guy do this all the time (can tell he isn't using the arrow key, because his cursor immediately goes to where he can enter the next property, without landing immediately to the right of the quote, as one does with the arrow key).  He's also darn fast, can't keep up!
    Thanks

    Set the beans propertie values to null in the constructor [If it is in pagecode]
    and in the jsp use binding
    Like for example:in the constructor of the pagecode
    public Some(){
    if((getFacesContext().getExternalContext().getRequestParameterMap().isEmpty()) || (getFacesContext().getExternalContext().getRequestParameterMap().containsKey("parkPlanFrm:prePlanName"))){
    ValueBinding vb = getFacesContext().getApplication().createValueBinding("#{bean}");
    Bean pcBean = new Bean()
    pcBean = (Bean)vb.getValue(getFacesContext());
    pcBean.getParkPlanCountyMenu().setSubmittedValue("select");
    pcBean.getParkPlanCountyMenu().setValue(null);
    vb.setValue(getFacesContext(), pcBean);               
    IN THE JSP:
    <h:inputText id="parkPlanPpn" styleClass="inputText" maxlength="15" size="15"
    value="#{bean.prePlanNumber}" binding="#{bean.parkPlanPpn}" size="15">
    </h:inputText>
    Here *value="#{bean.prePlanNumber}"* is from the Managed Bean
    *binding="#{bean.parkPlanPpn}"* is from PageCode
    Ravi

  • Can I make a special character appear when typing?

    Hi everybody.
    I have a form with a text field provided with a validation script, which allows the user only to enter values in the format 999999-9999. The script is places on the exit event.
    var myRegex = /\d{6}\-\d{4}/;
    var
    singleDigits = [0,1,2,3,4,5,6,7,8,9];
    If the format is not correct, the user will get an error-message.
    Now I would like the hyphen to appear automatically when typing. That means when the user has typed 123456 it will display as 123456-, ready to enter the last four characters.
    Is that possible.
    Kirstine
    P.S. I know I can make that (almost) happen if I make the field a numeric field, but for several reasons this is not an option.

    Here is a little script that can do what you are looking for..
    Place the script in the Change event of the Text Field and set the Max chars property to 11 for the Text Field.
    // restrict entry to digits and a dash
    if (xfa.event.change.match(/[0-9\-]/) == null)
        xfa.event.change = "";
    // Allow the hyphen at the 7th character only
    if (xfa.event.change == "-" && xfa.event.selEnd != 6)
        xfa.event.change = "";
    // If the 7th character is a digit, and they're typing at the end, insert the hyphen
    if (xfa.event.change.match(/[0-9]/) != null &&
        xfa.event.newText.length == 7 &&
        xfa.event.selEnd == 6) 
        xfa.event.change = "-" + xfa.event.change;
    // don't allow any characters past 10 (11 with a hyphen)
    var vMax = 10;
    if (xfa.event.newText.indexOf("-") != -1)
        vMax = 11;
    Thanks
    Srini

  • When typing in the selected tab, it types in another opened tab that is not selected, how is this fixed?

    For example:
    I have 3 tabs open.
    I have tab 1 selected, I switch to tab 3 and proceed to type (Log in details for example)
    When typing it out, the information I enter types out on tab 1, rather than 3, sometimes I don't check and press enter (Causing it to enter on tab 1, which could cause me to show my password on another site)
    I have to switch between tabs like 3-4 times in order to sort the priority out.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • When typing in a search in the address bar i get redirected to a search assist by Teoma. How can i stop this

    Normally when i type a subject into the address bar i get sent to a website that deals with that subject. For example if i typed in "Iron Man" in the address bar then i would be sent to a movie website with iron man details. Now when i type in a subject on the address bar i get redirected to a search assist website powered by Teoma. I haven't changed my default search and I've never even heard of Teoma so I really cant stand that i get redirected there. if i cant get rid of it then i am getting rid of firefox all together because that was the one feature that it had over internet explorer that really mattered to me. How do i change that

    I believe I've figured this out. You probably don't have a virus and there may not be much you can do. What is probably happening here is that the DNS provided by your ISP is trapping the request and redirecting you to the teoma server (run by ask.com).
    When you enter "flurdl" into the address bar, first the browser (& network stack) tries to resolve it as a host name into an ip address, by contacting the DNS server. If it resolves to an ip address, the connection proceeds. If DNS replies there is no such host, the browser passes it onto your search provider to perform a search.
    Your ISP has cut a deal with teoma such that when there is no host, instead of returning that, they return the teoma address. Your browser connects to that address and teoma returns its search page. So your browser never realizes it needs to search; it thinks it hit a valid page.
    Why do they do this? Because the search engine gets paid for the "preferred" entries in the search result.
    Your options are probably twofold: 1) don't search from the address bar, use the search bar instead. 2) Find another more honest DNS provider and configure it explicitly in your network settings.

  • OneNote 2013: Font changes when pressing Enter / Return key

    I have the same problem as this guy (who didn't get a relevant answer): http://social.technet.microsoft.com/Forums/office/en-US/233833f7-dde8-414d-bdca-604ed8d57667/onenote-2013-font-changes-when-pressing-enter-return-key?forum=officeitpro
    I set my default to Calibri 14, but every time I press enter (I make a lot of bullet lists) the font changes to Calibri 11. 

    Hi,
    Did you change the default font after you typed a few words in a note container?
    Setting the default font in Microsoft Office OneNote affects text that you type in new note containers only. It does not affect existing text or text that you add to existing note containers.
    If you want to change the font in an existing note container, you need to change it manually under
    Home tab > Basic Text.
    Thanks,
    Steve Fan
    TechNet Community Support

  • When typing a word document my laptop keeps sending the document

    Can anyone help - When typing a word document my laptop keeps sending the document when I start typing. Not sure why. Any help appreciated

    Hello
    I don?t know what you mean with laptop keeps sending the document but if you have this issue with office word or some other office application, try to check some forum where you can find discussion about similar theme.
    I can not give you any precise answer but it is maybe because of office specific settings or you press accidentally some key on the keyboard and on this way interrupt symbols entering.

  • When I enter 2000 it formats it as a date (1/1/2000 00.00.00)

    Hello,
    I'm new to Numbers. I'm using the latest version.
    But the problem is, when I enter 2000 which I would like to be a number, but it says in the lower left corner that it's: 1/1/2000 00.00.00. When I click in the format window, the dataformat is set to automatic. Have tried to change the dataformat to 'numbers', but it seems it changes it back to automatic, and I'm stuck again with the(1/1/2000 00.00.00.
    Thanks in advance.

    mdamsgaard1 wrote:
    Thank you, that worked.
    Know I don't know what part you think is a bug. But is it supposed to be like this every time I enter certain numbers or is THAT the bug?
    I would call that behavior a bug if you were pre-formatted as Automatic and a simple numeric entry turns into a Date value. It would be a failure of the compiler to properly detect the entry type.
    Jerry

  • When typing on laptop hand hits something, screen changes,lose current page??

    When typing on my laptop keyboard, sometimes the palm of my hand will hit some keys, don't know what or where, and my page might change or I lose what I have typed. Does this have anything to do with the "hot keys" on my key board for my Toshiba computer? Should I or can I turn off hot keys to avoid this? Please help as it is very frustrating when in the middle of something.

    I found on my laptop that the touch pad was interfering too much when I was typing so I started using a USB mouse and disabling the pad. It didn't stop all the behaviour you describe, but it has cut it down considerably. Now the only time this problem occurs is when I am being klutzy with my typing, such as hitting the Enter key when I want the right Shift key.
    Hope this helps some.

  • Safari quits when typing url, safari quits when typing url

    When I start typing a url in Safari on the iPad 1, Safari freezes, then quits. I can only reach a url if I type it in Google search, then click the link.

    I have this same exact issue.  Ipad is up to date with latest software update.  Question: do you have a LOT of bookmarks on the iPad Safari?  I'm wondering if this has something to do with Safari searching bookmarks for a match when you enter a URL.  I've used other browser programs and there's no problem so I don't believe this is an iPad system issue.  I believe it's a Safari issue.

  • Can I stop specific webpages apearing in address dropdown list when typing a webpage

    That is just the full question there, Can I stop specific webpages apearing in address dropdown list when typing a address?

    I believe I've figured this out. You probably don't have a virus and there may not be much you can do. What is probably happening here is that the DNS provided by your ISP is trapping the request and redirecting you to the teoma server (run by ask.com).
    When you enter "flurdl" into the address bar, first the browser (& network stack) tries to resolve it as a host name into an ip address, by contacting the DNS server. If it resolves to an ip address, the connection proceeds. If DNS replies there is no such host, the browser passes it onto your search provider to perform a search.
    Your ISP has cut a deal with teoma such that when there is no host, instead of returning that, they return the teoma address. Your browser connects to that address and teoma returns its search page. So your browser never realizes it needs to search; it thinks it hit a valid page.
    Why do they do this? Because the search engine gets paid for the "preferred" entries in the search result.
    Your options are probably twofold: 1) don't search from the address bar, use the search bar instead. 2) Find another more honest DNS provider and configure it explicitly in your network settings.

  • Why don't I get google results when typing keyword into the location bar?

    When typing keywords into the location bar, instead of taking me to Google I get a "problem loading page the connection was reset" error. And the domain it automatically takes me to is domainnotfound.Internetserviceprovider.net. Is there any way that if I don't type in a full url and just press enter it will give me the google results for those keywords? thank you for the assistance

    Sounds that your ISP is detecting whether a DNS look up fails in redirect you to that optimum.net url.
    In such a case you need to contact your ISP and ask them for alternative DNS servers that do not redirect you or you can set other DNS servers yourself.
    *http://kb.mozillazine.org/Error_loading_websites#DNS

Maybe you are looking for

  • Can no longer set non-default device with QT 7

    In Quicktime 6, I could choose a specific device to play through. I use this feature to play iTunes through a second soundcard and out to my stereo. I leave my default device set to the system soundcard where I have just headphones hooked up. This wa

  • Adobe Flash Player 11.3.300.265

    I downloaded this new update and it didn't work at all. I again had to uninstall and reinstall Adobe 10.3. I don't want to keep going through this. How can I find out when a new update works with Firefox? Does anyone know if Firefox is working on an

  • Installing 10.6.1 not successful

    I got a notice from the Software Update Manager saying I needed to update to OS X 10.6.1 and iTunes 9.0. I said yes, and the system started to reboot. During the reboot, I got the message "There was an error during installation." The system rebooted

  • Keynote - files too big to email/share, looking for PDF resolution solution

    Has anyone worked out how to change a keynote presentation PDF resolution when preparing for sharing? The file I get is too big to email (6 photos gave me 55mb) as it appears to retain the input resolution of the embedded photos?

  • TS1538 iPod can not be synced the required  file can not be found

    ipod canot be synced the required file cannot be found