code javascript does not work in a .jspx page

For the experienced:

I am trying to improve some pages in my application. In one of the pages, there are only two elements in the form: an input field (for the user to upgrade his user name) and a "submit" button. What I am trying to do are:

1 make the entry in short area when the page is loaded, so that the user can start typing immediately without having to fumble for the mouse and click the entry so that he can focus.
2. once the user has typed the username, by pressing the Enter key to send the form instead of fumbling again for the mouse and click on the submit button.

These are not hard to make. I wrote a page of test, and here are excerpts from the test page:

< pre >
& lt; < b > body onload = "document.getElementById('username').focus (); "< /b > & gt;
& lt; form method = "post" action = "http://host.domain.edu/pages/staffLogin.jspx" & gt;
& lt; table & gt;
& lt; TR & gt; & lt; TD & gt; UID: & lt; table & gt; & lt; TD & gt; & lt; Entry id < b > = "username" < /b > type = "text" name = "LoginName" & gt; & lt; table & gt; & lt; /TR & gt;
& lt; TR & gt; & lt; TD & gt; & lt; table & gt; & lt; TD & gt; & lt; input type = "submit" value = "Submit" & gt; & lt; table & gt; & lt; /TR & gt;
& lt; / table & gt;
& lt; / form & gt;
& lt; / body & gt;
< / pre >

This page is two things I want to accomplish, in Internet Explorer and FireFox. I didn't need to add any code for the Enter key to act for the submit button - it behaves this way by default.

But not in the page of my application, with snippets of code here:

< pre >
& lt; f: view & gt;
& lt; AFH:HTML... & gt;
& lt; AFH:head... & gt;
& lt; script type = "text/javascript" & gt; < b > self.resizeTo (900,1000); < /b > & lt; / script & gt;
& lt; meta... / & gt;
& lt; / afh:head & gt;
& lt; AFH:body binding = "#{staffLogin.body1}" id = "organe1" < b > onload = "document.getElementById('inputText1').focus (); "< /b > & gt;
... ...
& lt; AF:inputText binding = "#{staffLogin.inputText1}" secret = "true" < b > id = "inputText1" < /b > "
required = "true" requiredMessageDetail = "password required".
value = "#{staffLogin.submittedPassword} '"
< b > onkeydown = "if(event.keyCode == 13) () document.getElementById('commandButton1').click;' < /b > / & gt;"
& lt; AF:CommandButton text = "Submit".
Binding = "#{staffLogin.commandButton1}"id < b > = "commandButton1" < /b > "
action = "#{staffLogin.commandButton1_action}" / & gt;
< / pre >

What I'm doing wrong? DOM is recognized in .jspx? Note that the self.resizeTo (900,1000) < code >; < code > part of the work.

Thank you very much!


Newman

Hello

Use af:document instead of afh: html (etc.)

http://download.Oracle.com/docs/CD/B25221_05/Web.1013/e18745/tagdoc/core/document.html

initialFocusId

the id of the component that you want to only be when appears the entire page. Accessibility mode must be on 'inaccessible' for this function to be on. This attribute is not supported on the following types of agent: pda, phone, voice.

AF:form allows you to define the shape

http://download.Oracle.com/docs/CD/B25221_05/Web.1013/e18745/tagdoc/core/form.html

defaultCommand

The id attribute of the control whose action button would be invoked by default this form on hit enter on any of the fields of the form input.

You don't need JavaScript at all!

Frank

Tags: Java

Similar Questions

  • JavaScript does not work, even if activated in the preferences

    OK, so javascript does not work in my Firefox. I'm going to websites, try to activate some tabs, or similar, and nothing happens. Theres is a new site, which is linked to my University, and when I try to connect I get a message: Javascript must be enabled to use this Web site.
    Thing - it is turned on. I tried to restart (close-> close-> open-> mozilla mozilla activate on-> close mozilla-> open mozilla-> go to the website) but no dice...

    When I try to use IE, everything works, so I have NO idea what to do... Can anyone help?

    Hello

    Please check if this occurs in Safe Mode

    Extensions of the issues

    Troubleshooting Extensions and themes

    Uninstalling the modules

    Uninstalling toolbars

  • Code hints does not work.

    code hints does not work. Options are checked in the preferences, but no list of suggestions appears when I write the code.

    Any ideas? (Sorry for my English)

    Nicolas

    I find the problem!

    There seems to be a conflict with the port with an extensionnel screen display!

    When I start Dreamweaver with display port unplugged, dreamweaver works fine. And I can plug it after and it stills work. Other wise, if I plug the display port before launching dreamweaver, code hinting doesn't work anymore.

    Thanks to you all

  • JavaScript does not work in the published file

    Hello

    I am using the javascript in the captivate 5.5 for generating variable text in the text box. It works when I press the F12 key, but it does not work in the publication file.

    I called the function in the button and I wrote the script in the slide.

    Please let us know how to do this...

    Thank you

    Sirot BC

    Could you explain more detail? View code Javascript, and what you mean by "generate the variable text in the text box?

    You want to display the content of a user variable in a text caption? Or you want to change this variable first and then display it?

    Lilybiri

  • Popup JavaScript does not work using global variables?

    I have a menu region "References" which contains links to several pages pop up indicating the access codes of valid data filtered for the location of the user. I tried to make this work in another page by changing the references page to global variables variables / application, but it does not work. Can anyone suggest a work around? Here is the code I use:

    Target URL in link
    javascript:callEmpPopup('P1050_ORG_ID')
    JavaScript
      function callMyPopup (formItem1,formRow1) {
        var formVal1 = document.getElementById(formItem1).value;
        var formVal2 = 1;
        var url;
      url = 'f?p=&APP_ID.:1056:&APP_SESSION.::::P1056_FACTORY_ID,P1056_ROW:' + formVal1 + ',' + formVal2;
      w = open(url,"winLov","Scrollbars=1,resizable=1,width=1000,height=600");
      if (w.opener == null)
      w.opener = self;
      w.focus();
      }

    Blair:

    Use a "Hidden" type page element defined on page 0 instead of a part of the application.

    CITY

  • Why Javascript does not work properly?

    I'm working on a web page and try this script, but it does not work (although it works fine in IE). The code is given below:

    My function is:

    function validateNumber()
            {
                var x=window.event.keyCode;
                //alert(x);
                if(!(x>=48 && x<=57))
                    {
                        alert("Please type a number between 0 and 9 !!");
                    }
            }

    I use it as:

    <input type="text" name="cust_age" value=0 size="15" onkeypress="return validateNumber()" style="font-size: 16pt" />

    Please let me know how to solve this problem.

    Firefox does not use a global event of the window.
    On Firefox, you will need to pass the event to the function.

    I think it should work (I'm not an expert):

    <input type="text" name="cust_age" value=0 size="15" onkeypress="return validateNumber(event)" style="font-size: 16pt" />
    
    function validateNumber(event)
            {
                var x=window.event? window.event.keyCode : event;
                //alert(x);
                if(!(x>=48 && x<=57))
                    {
                        alert("Please type a number between 0 and 9 !!");
                    }
            }
  • My javascript does not work on Firefox

    I wrote a very small javascript. It works perfectly on IE, but it does not work on Firefox. Each javascript, I am writing to you, face the same problem. JavaScript is not disabled in my firefox browser, and I use the latest version (3.6.9). It's one of my scripts.

    < content meta = text/html"; charset = utf-8 "http-equiv ="Content-Type">"
    < title > Untitled Document < /title >
    < script language = "javascript" >

    function namechecker()
    {
    var firstNameLength = txtFirstName.value.length;

    even if (firstNameLength == 0)
    {
    firstNameLength = prompt ("enter your first name","" ");
    txtFirstName.value = firstNameLength;
    }
    }

    < /script >

    Enter your first name:
    < name of entry = "txtFirstName" type = "text" >


    Enter your last name:
    < input name = "txtlastName" onfocus = "namechecker ()" type = "text" > "

    This problem persists for me after updating to 3.6.10. Many web sites, even Google, unusable due to JavaScript errors. The problem could be solved by disabling the cache. I also noticed that some images for some pages do not load until the cache has been cleared, so I suspect that this is not a JavaScript problem but a bug in the way Firefox handles caching. Unfortunately, I can't reproduce this problem systematically.

    This problem occurs on 2 separate machines that are both running Windows 7 Pro 64 bit. Some installed extensions: Firebug (disabled), Xmarks.

    A page that I am wrong with this time is http://cgsmd.isi.edu/dbsnpq. Errors are "$ is not defined", "jQuery is not defined" and some images do not appear, while some arise. When I go to about: cache? device = disk I can located at the URL of the JavaScript file. When I followed links to this cache entry, and I can see that the corresponding cache file does not exist. This is the file:

    C:\Users\Scott\AppData\Local\Mozilla\Firefox\Profiles\jlz39414.default\Cache\83E84132d01

    I did the same thing for some images. Some I can find in everything: put in cache and view them, other are listed, but the data is not - these are those who were not initially. In all: cache he requests these minutes just cached were there probably isn't another 'cleaning' software removes these files.

    Conclusion: there are bugs in the system cache of Firefox that make many common web sites, such as Google, unusable.

  • Why YouTube video does not work in my Web page?

    I have searched for Dreamweaver, Adobe in general more than any other source of information, but can not get a YouTube video to my web page.  I did all the 'action', 'Embed' stuff, created of the divs, ignored divs... nothing works.  I copy the code, it seems, go to preview and browser and I get a gray box or anything!  Can someone help me with this please?  I am currently using Dreamweaver CC 2014 and it leads me to madness.

    Thanks in advance for any advice.

    It does not work in Live View, preview mode local a browser or online after downloading?

    Videos YouTube and the local preview browser settings do not tend to agree.

    For all of my built-in youtube, design view displays a gray box. Mode Live View shows the space for video and an error "Could not load" because the embed youtube I use has a relative link Protocol (starts by / /) and file uses: instead of http:. When downloaded the file works fine because the current page uses the Protocol http then the relative link of protocol adds it in the browser.

    If your site uses only http (not https) pages add http: in front of the / / so he could view in Live View and found the.

    If none of the above applies to your situation, could you post a link?

  • HTTPS Post does not work in the OFA Page

    Hi all

    I created a Page of the OFA, by clicking on button I do next.

    //--------------------------------------------------------
    private static String contactService(String xmlInputString) throws Exception {}
    String outputStr = null;
    OutputStream outputStream = null;
    try {}

    URL url = new URL ("https://wwwcie.ups.com/ups.app/xml/ShipConfirm");

    HttpURLConnection connection = () (HttpURLConnection) url.openConnection;
    System.out.println ("Customer connection established with" + url.toString ());
    Configure the HTTP POST parameters
    connection.setDoOutput (true);
    connection.setDoInput (true);
    connection.setUseCaches (false);

    outputStream = connection.getOutputStream ();
    outputStream.write (xmlInputString.getBytes ());
    outputStream.flush ();
    outputStream.close ();
    System.out.println ("Http status =" + connection.getResponseCode () + "" + connection.getResponseMessage ());

    outputStr = readURLConnection (connection);
    System.out.println ("Response..." + outputStr);
    } catch (Exception e) {}
    System.out.println ("error sending data to the server..." + e.getMessage ());
    throw e;
    } {Finally
    If (outputStream! = null) {}
    outputStream.close ();
    outputStream = null;
    }
    }
    Return outputStr;
    }

    //----------------------------------------------------
    public static String readURLConnection (URLConnection uc) throws Exception {}
    StringBuffer buffer = new StringBuffer();
    BufferedReader reader = null;
    try {}
    reader = new BufferedReader (new InputStreamReader (uc.getInputStream ()));
    Letter int = 0;
    reader.readLine ();
    While ((letter = reader.read ())! = - 1) {}
    Letter from buffer. Append ((Char));
    }
    Reader.Close ();
    } catch (Exception e) {}
    System.out.println ("could not read from URL:" + try ());
    throw e;
    } {Finally
    If (reader! = null) {}
    Reader.Close ();
    Reader = null;
    }
    }
    Return buffer.toString ();
    }

    Now, when I run this JDEVELOPER local it works fine, but when when depolyed on the server, then when I click the button then page gets hanged and it does nothing.
    Is there any setting I should do in APPS environment. or anyone had done the same. any help will be appreciated.

    Thank you
    Vijay chraibi

    Hello

    If your code works fine in JDev and it does not work on the instance, then you can trigger SR with Oracle for Ptoduct JDeveloper.

    Kind regards
    Out Sharma

  • The add-on Adblock Plus for Firefox does not work on a Livestream page.

    I just install it because I get a video ad on a web page of Livestream. It does not work.
    Disable all is checked.

    Maybe you can ask the team of Adblock, you're very likely to get the best help there.

  • "back" button does not work and the home page does not display on startup

    My buttons next and previous no longer work. They show just gray and I cannot click on them.
    Also my home page does not appear when I launch firefox.
    I reinstalled firefox 4 and then I went back to firefox 3.6.16 and have the same problem in both versions.
    Don't know what to do anymore
    I just found out that when I opened a second window everything works well in the second window, but it still does not work in the first window.
    The same thing happens when I close both windows. The first window of my home page does not appear and the back button does not work, but the second window is operating normally. Including my home page.

    Try:

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > appearance/themes).

    • Makes no changes on the start safe mode window.

    See:

  • Disclosed property does not work while navigate taskflow page?

    Hi all

    I use JDeveloper 11.1.1.4.

    My scenario is that I have a page with three showdetailItem surrounded by component unique Panel-tab.

    In my second showdetailitem, I have the button to navigate to other pages in stubborn taskflow.

    My problem is all coming back from taskflow page, the detail element see the second must be open. I tried with disclose property to point detail see the, but it is not working navigation the taskflow page.

    My Codes like:

    < af:panelTabbed id = "pt1" >

    < af:showDetailItem id = "sdi1" text = "TabOne" >

    < af:outputText value = "This is firstTab" id = "ot1" / >

    < / af:showDetailItem >

    < af:showDetailItem id = "sdi2" text = "Tabtwo" disclosed = "#{(pageFlowScope.showTab!= 'null') and (pageFlowScope.showTab eq 'secondTab')? 'true': 'false'}" > "

    < af:commandButton action = "GoTaskflow" text = "GoRoom" id = "cb1" / >

    < af:outputText value = "This is secondTab" / >

    < / af:panelGroupLayout >

    < / af:showDetailItem >

    < af:showDetailItem id = "sdi3" text = "TabThree" >

    < af:outputText value = "This is ThirdTab" id = "ot2" / >

    < / af:showDetailItem >

    < / af:panelTabbed >

    Taskflow page:

    < af:panelGroupLayout >

    < text af:commandButton = 'Back' action = 'ParentPage"id ="cb1">

    < to af:setPropertyListener = "#{pageFlowScope.taskFlowshowTab"secondTab"=}" type = "action" / > "

    < / af:commandButton >

    < af:outputText value = "this is the Page in stubborn taskflow" id = "ot1" / >

    < / af:panelGroupLayout >

    Thank you.

    Hello

    "flow type second task has its own pageFlowScope and setting"af:setPropertyListener from ="secondTab" to = "#{pageFlowScope.taskFlowshowTab}" = "action" will write in the flowrate range of the second page (called the workflow), not one. " To achieve what you want, use a return value on the called workflow (you reference #{pageFlowScope.taskFlowshowTab} in the return value parameter). Calling the workflow (on the flow working call activity, will take this parameter value (see range of property) and copy it into #{pageFlowScope.showTab})

    Frank

    PS: Note that even if the flowrate page range was shared through BTF (which is not the case), your code would have another flaw, which is to use names of different attributes of memory to hold the name of the tab to disclose.

  • Interactive navigation button does not work on a specific page

    Hey everybody

    I used interactive navigation buttons in my document.  But when I come to page 7 I can't go any further (yet there are 5 pages coming soon).  The navigation on this page button does not work.  Can someone tell me how to solve this problem?

    Thank you

    Wendy

    Hello

    As Bob, today is your lucky LOL day - I am bilingual... so let me try and answer ;-) in Dutch

    IK zou ten eerste Gebeurtenis veranderen naar: Bij Loslaten of will.

    All en in het Lagen Panel een nieuwe laag aanmaken die ridiculous laag is.

    En dan knop in die laag plaatsen.

    Hopelijk works het dan wel.

    Line,

    CARI

  • JavaScript does not work anymore

    Since after I installed Firefox BETA 13 and again after removing and installing Firefox 12, no javascript code runs on the Web sites. In preferences, everything is active and resolved (and without change). I tried to update to aurora, but it did not work as well...

    I found it - it's kaspersky addon for firefox, which disabled...
    now everything works well again...

  • XML of LiveDocs code example does not work

    Hello, I am new to Flex with a background in JS, HTML, CSS and PHP. I am trying to learn by following examples of LiveDocs. Example XML file loading, found here, will not work for me. I created a basic XML file and pasted the code in an MXML application inside '< mx:Script >' vanilla. When I run the application, I get two errors number 1120 similar on the line indicating "myLoader.addEventListener ("complete", xmlLoaded);". Error messages are telling me that "telephone" and "xmlLoaded" of properties is not valid. How can I fix this to work properly?

    Here is an example of the XML file that I use.

    There are several problems with this article of dip. The url does not appear to exist, so I put the xml data in a data4.xml file in a local xml file 'data' that should be a subdirectory of the directory containing the file mxml app.

    In addition, the variables must be declared outside a function to be global, but the addEventListener line must be in a function, so I put it in an init() function to call on the initialization of the application.

Maybe you are looking for

  • Satellite U500 - 11 c - after updating Win7, the eco button no longer works

    Hello Recently I upgraded my OS from Win Vista 32 bit to Win 7 32 bit with the TOSHIBA DVD and since then, the eco button no longer works. When I press on it, the laptop is not set the eco mode. Does anyone have the solution for that, please?

  • Unwanted network connections.

    To start, I hope that this post will be in communities to Support Apple > Mac OS & software system > El Capitan... I am currently using a 13 "Macbook Pro late 2014 RETINA display SSD hard drive with a processor intel i5. However I used the Mac for 10

  • Music files duplicated hard disk, but not in the iTunes program.

    Hello I use the 64-bit version of iTunes (v 10.1.1.4) on Windows 7 Home Premium (x 64). My music collection must be about 7.5 GB. However, on my drive hard, the 'My music' folder is double this size - 15 GB. It seems two files (see below) containing

  • Cisco IOS 12.4 vs 15.1

    Hey, I heard that IOS 15 is basically 12 with more features. Remain the same all orders or are there changes in the structures of command for some parts?

  • JDeveloper - menu of the toolbar

    HelloI need to create a Menu Option like in form 6i, I used to generate the form of Menu and from their I called all forms and reports. and controlled all the forms and the report with form security user Table Table.Developer J and ADF, I want to cre