Onfocus

Hi,
I have two text fields and the first text field is always not onfocus when the page loads. I even ordered the first text field as "10" and the second one as "20". Is there a way to ensure that the first text field is onfocus when the page loads? Thanks.

Hello Jacky411,
You may do the followings:
Option #1:
a)In the "Page Attributes", ensure "Cursor Focus" in the section "Display Attributes" as First item on page.
Option #2:
a) Assuming the name of the first textfield is "P1_FIRSTTEXTFIELD".
b) In the "Page Attributes", ensure "Cursor Focus" in the section "Display Attributes" as Do not focus cursor.
c) In the "Page Attributes", put the following code in "Header Text" of the section "Header and Footer":
*<script type="text/javascript">*
function setFocus(elementID)
document.getElementById(elementID).focus();
*</script>*
d) In the "Page Attributes", put the following code in the "Page HTML Body Attribute" of the section "HTML Body Attribute":
onload="setFocus('P1_FIRSTTEXTFIELD')"
JT

Similar Messages

  • Onfocus/onblur attributes not rendering in inputText

    So I have a tag that calls a javascript function that displays and hides a yahoo calendar. (yeah I know there is a tomahawk component for this, but there are some functionality that I need that is better in the yahoo calendar). Anyways, when I was running 1.2_04 the onfocus and onblur attribute would render, but I upgraded my glassfish server to 1.2_08 and now those attributes no longer render. I don't see any changes in the documentation that would indicate a change in behavior for this component. Here is my line of code:
    <h:inputText id="end" label="End Date" validator="#{QuickSearchManagedBean.validateEndDate}" required="true"
    value="#{QuickSearchManagedBean.end}"
    onblur="hideCal('endContainer');updateBeginDate(this.value);"
    onfocus="clicked_input = this; showCal(this,'endContainer',end)" styleClass="calendar">
                  <f:convertDateTime timeZone="#{QuickSearchManagedBean.defaultServerTimeZone}" pattern="MM/dd/yyyy"/>
    </h:inputText>

    Here is some information which might help in troubleshooting: since JSF 1.2_05 there was an update in the API regarding to rendering the on* attributes. So, if you're using jsf_impl.jar of version 1.2_05 or newer, but are still using the older jsf-api.jar, then the on* attributes won't render. Make sure that the Glassfish /lib contains the right jsf-api.jar for the jsf_impl.jar and also make sure that there is no older API somewhere else in the classpath, like /WEB-INF/lib.

  • Calling function at onFocus statement

    may i ask that the below code is correct or not?
    <jsp:useBean id = "pc" class="common.claim" scope="request" />
    <td id=progPect><input type="text" size=5 id="progPect" value='<%=progPect.elementAt(c)%>' onFocus="<%=pc.chkBreakdown(wp.elementAt(c),ln.elementAt(c),la_no);"></td>
    and this pc.chkBreakdown function is location at class file.
    and this function does return an boolean, either true or false.
    if return value is true, then link to the other page.
    how to write the code at the onFocus statement there...plz help..

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    applicationComplete="functionName()">
    or you could trigger it on creationComplete event, or initialize event;

  • OnFocus won't die

    I have a couple of buttons that open a browser window when
    clicked. The
    window loads a pdf file.
    For some reason DW insists on putting an onFocus event to
    open a
    browser window in the code even though I delete it and save
    the file.
    The next time I open the file, it's back and the file that is
    assigned
    to the open window no longer exists.
    The page is here:
    http://righttax.org/pdf.html
    and the onFocus is at
    the top of the editable region.
    Is this a bug? Will it cause a problem?
    Thanks
    DW8 Mac.

    Try this?
    java -Xms256m -Xmx320m -XX:PermSize=64m -XX:MaxPermSize=128m -jar /usr/local/lib/eclipse/startup.jar -os linux -ws gtk -arch x86 -launcher /usr/local/lib/eclipse/eclipse -name Eclipse -showsplash 600 -exitdata 4aeb003f -vm /opt/java/jre/bin/java -vmargs -jar /usr/local/lib/eclipse/startup.jar

  • Using onFocus method with embedded html

    Hi,
    I have embedded html in a servlet. I am using a text field to call the onFocus method with the following code:
    out.println("<input type='text' name='name' value='0' onFocus='if(this.value=='0')this.value=';'>");
    If I was using straight html with no servlet this works fine. When the user clicks on the field the default value is automatically erased.
    Why will this not work in a servlet?
    I have also tried calling a javascript function. Please note that I successfully use javascript with input type 'button' to render a pop up window with dimensions. So my javascript inside a servlet works elsewhere.
    Thanks VERY MUCH for your time
    Rick

    I don't think it's the same as I'm doing. Essentially, I have a JEditorPane subclass, which just has a few custom tags in it. I don't need them to be recognized by java, since it will be uneditable, but I just need to know how to convert from the getText() locations to the actual displayed text locations.
    Also, when I set the text as text/html, it creates a bunch of extra HTML tags, so it's larger than the original String used to create it.

  • How to change color of onfocus boder of button

    i'm having a code like this MyButtonListener extends BasicButtonListener
    public void mouseEntered(MouseEvent e) {
         AbstractButton b = (AbstractButton) e.getSource();
            ButtonModel model = b.getModel();
            if (b.isRolloverEnabled() && !SwingUtilities.isLeftMouseButton(e)) {
                model.setRollover(true);
            if (model.isPressed())
              model.setArmed(true);
        }After doing like this onfocus to button with mouse gives a yellow color focus boder to button. but i want to overide that yellow color to red. how can i do it?

    This works with the default Metal L&F with Ocean theme. No guarantee for any other L&F / theme.Border outsideBorder = new MetalBorders.ButtonBorder() {
       @Override
       public void paintBorder(Component c, Graphics g, int x, int y, int w,
               int h) {
          super.paintBorder(c, g, x, y, w, h);
          ButtonModel model = ((JButton) c).getModel();
          if (model.isRollover() && !(model.isPressed() && !model.isArmed())) {
             g.setColor(Color.RED);
             g.drawRect(0, 0, w - 1, h - 1);
             g.drawRect(2, 2, w - 5, h - 5);
    CompoundBorder buttonBorder = (CompoundBorder) UIManager.get("Button.border");
    buttonBorder = new CompoundBorder(outsideBorder, buttonBorder.getInsideBorder());
    UIManager.put("Button.border", new BorderUIResource(buttonBorder));The rollover color will also affect the arrow button of a JComboBox and may affect some other components.
    db

  • Showing/Hiding annotation with onFocus/onBlur

    Hi-
    I'm having trouble using the onBlur and onFocus events in the same form field.
    I have an annotation that has these props when the document loads: What hidden=true and popupOpen=false
    On a form field, I've attached the following script to the onFocus event:
    var annot = this.getAnnot(0,'phoneTip');
    annot.setProps({
        hidden:false,
        popupOpen:true
    This works fine when I don't have an onBlur event. (The annotation shows up when cursor enters field)...
    BUT, when I add the following script to the onBlur event, the annotation disappears and doesn't come back onFocus:
    var annot = this.getAnnot(0,'phoneTip');
    annot.setProps({
        hidden:true,
        popupOpen:false
    What seems to be happening is the OnBlur event is firing right after the onFocus. When I dump the annot props above the set method in onBlur, I do see the correct values (hidden=false, popupOpen=true).. Maybe when I show the annotation, the annotation itself gets focus, and therefore the field loses focus and the onBlur event fires?)
    Does anyone know a workaround for this? Maybe a way to maintain focus on the form field?
    Thanks

    Hi-
    @GK - Thanks for the reply. Not sure I understand what you mean tho.
    Fwiw, this doesn't seem to be a propblem if you don't use an annotation with a popup window (which steals the focus from the form field, causing the field.onBlur event to fire). So, if anyone else runs into this issue, try using 'FreeText' type...

  • GCC onfocus window event differs between IE 6 and IE5

    I have a portlet.aspx in 4.5ws that currently contains a list of items that are essentially anchor tags.   When a user clicks on the link a new window is opened to display the data, when the user closes the new window the onfocus event is fired and the program executes generic function DoSomething (In IE6).
    In IE5, when the user clicks on link, the onfocus event fires in the background while the window is opening.   Any reason for this?
    The windows are opened using the javascript function window.open(someURL);
    Thanks
    Andrew

    Mostly, we just documented it as a known issue; fortunately, that was feasible for us. Our customers don't typically open and close many new windows of our app, so it's not the end of the world.
    When I dug into this, I saw some pretty bizarre behavior from IE: even when you close the underlying Socket and you see the appropriate FIN TCP wire messages, IE would *still* not let Flex open new connections to the same host. This persisted until you restarted not only the current browser, but all IE instances. The connection book-keeping is somehow totally fubared.
    What we *considered* doing but ultimately determined to be impratcical was to only have the main application open these connections, and the other instances marshall their network communication through the main app using LocalConnection. In theory, this should work, but it's likely to be very awkward.

  • OnFocus Problem

    Hi
    I have and onFocus=javascript:doSubmit() in the HTML item attribute to submit the page after selection form a poup lov. I am having problems with it as it is continually resubmit the page. Any ideas how to resolve this.
    Thanks
    Fiona

    See
    Oracle Application Express (APEX)
    Popup LOV with submit

  • How Mask my datefield to __/__/____ on onfocus

    Hi Team,
    My Jdev - 11.1.1.6.0
    I have af:inputDate field on my jsff page. I have applied clientLisetner on inputDate field.
    From client listener i am calling one javascript method which is resposilbe for giving me pattern of inputDate in this formate :-  _ _/_ _/_ _ _ _
    And client-listener type = focus.
    I am facing problem that when i clicking on inputDate field and if i dont want to enter any date then its forcing me to enter date otherwise its not allow me to navigate to different page.
    Can you please help me how i can restrict inputDate field to make it nullable even also if i try to focus on it.
    code -
    <af:inputDate id="endDateDt"
                                 binding="#{pageFlowScope.GroupDivisionBean.endDateDt}"
                                 shortDesc="#{commonResourceBundle['LABEL.HINTS.DATE_FORMAT']}"
                                 styleClass="contentDate" autoSubmit="true"
                                 disabled="#{pageFlowScope.isContractCreated}"
                                 label="#{commonResourceBundle['LABEL.END_DATE']}"
                                 validator="#{pageFlowScope.GroupDivisionBean.neEndDateValidator}"
                                 clientComponent="true">
                      <af:clientListener method="onEndDateFocus" type="focus" />
                      <f:validator validatorId="ema.EligibilityDateValidator"/>
                      <f:attribute name="effectiveDateDt" value="effectiveDateDt"/>
                      <af:convertDateTime type="date"
                                          locale="#{facesContext.externalContext.requestLocale}"
                                          pattern="#{sessionScope.isFromMexicoApp eq 'MX' ? 'dd/MM/yyyy':'MM/dd/yyyy'}"/>
                   </af:inputDate>
    javascript function:-
    function onEndDateFocus() {
            $("input[type=*][id*=endDateDt]").mask("99/99/9999");
    Thanks in advance.
    Thanks
    Ramit Mathur

    Its not working
    I have tried all but not getting value.
    Do you have anything to masking dateformate on onfocus like this link:-
    https://community.oracle.com/message/4098045#4098045

  • Make coded ui tests wait for onfocus event during playback - SharePoint 2010 InfoPath form

    I recorded a coded UI test of a SharePoint 2010 site hosting an InfoPath form. The combobox on the infopath form loads the items on onfocus event. It seems that the  coded ui test do not wait for the onfocus event to complete and tries to select the
    item and fails with the error
    The web page could not be accessed. If the page is refreshing, please wait until the page refreshes and then perform actions on it. 
    how can i make the Test to wait till it completes the onfocus event and then select the item.
    one approach i applied was  
    bool bReady = false;while (!bReady)
    try
    uID4ComboBox1.WaitForControlReady();
    // Select 'RMA2' in 'D4' combo box
    uID4ComboBox1.SelectedItem =this.CreateProposalParams.UID18ComboBox1SelectedItem;
    bReady =true;
    catch
    Playback.Wait(1000);
    But i have a lot of combo boxes which makes this solution difficult to implement.
    Thanks in advance.

  • Onfocus expand drop down list

    Does anyone know how to code the onfocus or enter field to expand the drop-down list and/or to highlight a list item based on enter the first, second letters? I have seen the effect as you begin typing the first match shows up, then moves with the second letter to the next first match.

    You can only use the 1st letter to move the focus in the DDlist.
    Paul

  • OnFocus problems

    I have this problem with an input TextField. I had it working
    before but for some reason, something changed. I have an input
    field that starts with some text, and then has an onFocus function
    so that when you give it focus, it clears, and then an onKillFocus
    that restores the text the field is blank when focus is killed. It
    worked fine for a bit and infact I have a working version
    here.
    However, after some changes I've made (which I've tried to take
    out, but still get the same results) the onFocus handler is called
    a second time after I click away from the input box. So in short,
    it won't let me loose focus from the input TextField by clicking
    anywhere else in the movie, in order to loose focus, I have to give
    focus to another input field (like a checkbox or button). I thought
    this started happening when I put the other input fields on the
    stage, but I tried killing them and it's still happening. You can
    see what I'm talking about by going
    here. Any
    ideas?
    P.S. Please don't leave too many goofy comments =D

    P.P.S. To see what I'm talking about, click in the text box
    and then click in the gray next to the text box.

  • OnFocus event and hilighting

    I have a form with loads of text input boxes. As a person travels (using tab or mouse click), I need to high light the current text box the user is in by may be having a little dar outline than the other text boxes or some other means?
    I know I should do this on the onFocus event, but what exactly should I do to achieve this effect?

    Sorry we haven't been able to help you. I'm not quite sure what you should do. This is really a matter of writing the proper Javascript. You should set the onFocus or onSelect attributes of the textInputs to some method that knows to highlight them in some way. UIX doesn't provide any out of the box support for this since it's uncommon behavior for HTML-based apps.
    - Ryan

  • OnBlur and onFocus

    I have a quick question about onBlur and onFocus - will the onBlur complete any code that is behind it before the onFocus takes effect ? I have comboboxes that are in line and i need to be able to do work if there has been a change by the the onChange call.
    Thanks

    first of all.. this is a JavaScript thingie.. not JSP
    second.. what has your thing with onChange has to do with the onBlur and onFocus?
    and it's not a question wether onBlur will complete it's code before the onFocus takes effect. If you have a field with an onBlur and onFocus action.. it never executes these scripts at the same time. onFocus gets enables when you enter the field, en onBlur when you exit the field.
    If you have 2 input fiels (both with onFocus and onBlur), and you go out of field1 (onBlur) and into field2 (onFocus) it first executes the onBlur-script till it's finished, and then will go over to the onFocus.
    ... or i just misinterpreted your question

Maybe you are looking for

  • Bridge requests

    These issues may have been added/changed in CS3 Beta, or have already been suggested (I did look), but... In Bridge, add the ability to save all keywords w/o quitting Bridge. Or, have Bridge automatically save them on the fly in case Bridge/computer

  • Cannot open HTML files on Win7 using FF 3.6.10 as default browser.

    When I click on any HTML file in Windows 7 (64 bit, Ultimate) I get an error dialog that says "There was a problem sending the command to the program." The only way I can open local HTML files is with IE as default browser - which I do not want. I fi

  • Putting a symbol on a 3-d object

    What are some reasons why a created wont show up on a 3-d object. I made a graphic symbol but it will not show up on the object when I select it in Map art. It is on the correct layer. What I create another small symbol, like a box or a simple path i

  • Can you sell two products from one inventory listing?

    The scenario is as follows: We buy one product 'ABC' from our supplier and store this in a location in our warehouse. We sell this product to our customers as part number 'ABC'. The issue arises because we also sell this product as a different produc

  • Setting a server wide variable at startup

    Anyone have a way to set a server wide variable (likely in the server scope) that gets set on server startup rather than in a specific page request via a cfset. What I would like to be able to do is set a variable external to any application that des