How to determine stage focus

I have two input text fields and I want the user to be able to enter data into either one of them and have the other update with the same information.  I am trying to set up an if statement that looks for the current textfield like this:
if (CURRENT TEXTFIELD == box1){
but I don't know how to detect the current textfield.
Can anyone tell me the proper code for "CURRENT TEXTFIELD"?

This is what I tried.
var currentBox = event.target.name;
if (currentBox == "box1" ){
  box2.text = box1.text;
I traced the event.target.name and got "instance12" back  even though I set the instance name to be "box1".  Why is that?

Similar Messages

  • How to determine the stage orientation portrait or landscape

    Hello,
    how to determine the stage orientation portrait or landscape in flex 4.5 (flex hero this.navigator.landscapeOrientation doesn't work).
    thanks.

    Application now has a aspectRatio property.  You can use that to determine whether the application is in a landscape or portrait orientation.
    Chiedo

  • Giving Stage Focus When First Opening In Browser Window - How??

    Is there any reliable way to give the stage focus when you first open it in a browser window WITHOUT first clicking on the stage? By reliable, I mean something that works across different browsers and on both PCs and Macs.
    I've seen numerous threads on this subject, and I've read the Adobe tech note, and it seems there is no reliable way. This is a joke, right???? How in the world can Adobe ask people to use Flash and not provide a reliable way to give the stage focus on startup. Requiring the user to click on the stage first is totally stupid.
    Has this problem been solved since all the other threads were posted, and if so, what's the solution?
    Thanks.

    for online swfs, it's a security issue and there's no reliable way to do it.  for local files, it's straight-forward.

  • JSF: How to determine which element has the focus?

    Hi all,
    I have a JSP with some input fields and a text area. When I press "ENTER" the data I have entered should be saved. That works fine (I use JavaScript to catch the keyPressed-event). But when I want to insert a new line in the text area, I press ENTER too and this invokes the javascript function. So it�s not possible to insert a new line in the text area. And I don`t want to save the data when I�m just inserting a new line.
    is it possible to determine which element has the focus at the moment of pressing ENTER? if it`s the text area then I won�t save the data and inserting a new line is possible? Or how to say: "Insert an new line if the user presses SHIFT+ENTER" or something like that?
    I�m using JSC for my application and this is my JS-function:
    function checkIt(evt)      
    var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
         if (charCode == 13)
              document.getElementById('form1:bt_Save').click();
              return false;
              return true;
    I�m looking for something like that:
    if(charCode == 13) {
    if(document.getElementById('form1:textArea').hasFocus())
    doNothing...
    else {
    document.getElementById('form1:bt_Save').click();
         return false;
    thanks for any help

    Hi,
    I searched through many forums (js of course too) but
    I couldn�t find a solution. Everybody knows how to
    set the focus but not how to get it. We often use
    JSF/JSP with javascript and maybe somebody here has
    another approach to this problem (how to solve it
    using jsf itself or anything else)?Take easy. I just suggested to search in a JavaScript forum , in your question you didn't mentioned this. Good luck man.
    Cya.

  • In Flex,how to make lost focus of textinput on enter click?

    Hi
    In Flex,how to make lost focus of textinput on enter click of keyboard ?
    Thanks,
    Sunil

    Hi vibhuti,
         I  got your point but it will not helpful to me.
        But I found solution ,When user clicks enter key make stage.focus = null  so it will lost focus on text input and make focus in my current Alert Box.
    Thanks,
    Sunil

  • How to determine T440s Synaptics Trackpad Firmware version

    How do I determine the current firmware version of my touchpad?  The readme file for the firmware update does not say how to determine what version is already installed. 
    http://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/grgy03ww.txt
    .NET Software Developer
    ThinkPad T440s (20AQ005TUS) | ThinkPad ThinkPad T430 (2342CTO) | Lenovo H430 (25582AU) | ThinkPad X230 (2306CTO)

    I ended up soldering leads on the main board and captured the boot log. I managed to find only one other boot log to compare to (here) but comapring the two hasn't given me much insight. On the surface it seems like my issue is that the AHCI SATA loader is trying and failing to get port 0 to respond. I've posted the full boot log here, but I'll post the last bit here in hopes that someone can point me in the right direction. Thanks. Hit any key to stop autoboot: 0
    init_sata:
    serdes: 24Mhz ref clk
    Serdes 1 : CMU OK
    Serdes 1 : Lane OK
    Serdes 2 : CMU OK
    Serdes 2 : Lane OK
    cap 0x6f26ff81 port_map 0x3 n_ports 2
    P#SERR 0x4050002
    IS 0x0
    Port 0 control: 0x300
    Port 0 status: 0x123
    P#SERR 0x0
    IS 0x1
    Port 1 control: 0x300
    Port 1 status: 0x0
    GHC 0x80000000
    GHC 0x80000002
    ahci_init_one: SUCCESS
    SATA Controller Info:
    AHCI 0001.0300 32 slots 2 ports 3 Gbps 0x3 impl SATA mode
    flags: ncq stag pm led clo only pmp pio slum part
    Enter start port: 0
    Port 0 status: 123
    cmd_slot = 0xb06000
    Device not ready. BSY, DRQ or ERR in TFD!
    Can not start port 0
    timeout exit!
    sataenv: GPT header not found
    timeout exit!
    sataenv: partition 7 not an environment
    timeout exit!
    sataenv: GPT header not found
    timeout exit!
    sataenv: partition 8 not an environment
    timeout exit!
    GPT header not found
    Bad Magic Number
    arg1 char: s
    Barebox-C2K >/ 

  • Air3.0 and the softKeyboard not appearing on Stage.focus = InputTextfield on iOS

    In RC1 of Air3.0 and earlier versions of air, I could summon the softkeyboard for the iPhone/iPad by doing this.
    Create an inputtext field, set it's width and height to 0 to hide it
    Then, when I want to show the soft keyboard, simply do:
    stage.focus = txtCapture;
    Where txtCapture is my input text field. When I wanted to hide it, I would simply set the stage.focus to any other object.
    This worked great until 3.0 was offically released and now the softkeyboard does not appear on the set focus, it ONLY appears if you manually click on the input field itself, but since you can't use center alignment or any other formatting on input text fields for the iOS, I can't let it be seen
    Anyone have any idea how I can get the softkeyboard to appear?

    I think we're experiencing an issue with this:
    We're trying to use the iCade cabinet with an iPad and a Flash application (though this shouldn't affect the problem as the problem can be replicated without any connection or involvement with the iCade unit).
    To make sure that the app is able to respond to the iCade's input (which is a simulation and transmission of certain keystrokes for each input), we create a TextField set off-screen and keep it visible (as this seems to be a requirement), and then we set the stage focus to that TextField. We also invoke requestSoftKeyboard on the TextField.
    I learnt from this thread that setting stage focus isn't required, but I had the same issue as someone else here, in that I read that requestSoftKeyboard isn't supported on iOS - the documentation could be more clear about exactly what this means, like it's been explained here. Besides, setting stage focus should be fine, and not the cause of the issue I'm about to explain.
    We have needsSoftKeyboard=false on the TextField, and after setting that, we request the soft keyboard. The upside is that this appears to prime the runtime to respond to keyboard input regardless of where it's coming from, and the keyboard usually stays hidden. Our problem is that, sometimes on app startup and sometimes up to 15 minutes of idle time later, the soft keyboard appears without prompt or user input.
    Is this intended behaviour? We're only developing this application for iOS, and aren't sure if the issue is perhaps to do with the iOS soft keyboard.
    We also tried handling the soft keyboard events (such as Activate, Activating and Deactivate) to attempt to stopImmediatePropagation and preventDefault. These seem to conflict with our setting focus in the first place, so I don't think we can make use of these. We tried only preventing the event when our target TextField already has focus, but this didn't work, and I think at this point we were really just shooting in the dark!

  • Stage.focus doesn't show cursor in TextField?

    stage.focus = txt; // txt is a text input field
    It successfully gives the TextField "txt" focus because when
    I type, the characters appear in the input textfield, however the
    familiar blinking text cursor/beam does not appear in the
    textfield. This makes you think it does not have focus, so you
    click the textfield to give it focus -- completely defeating the
    purpose. What's the deal?

    Doing some searches online I found myself asking this
    question over at asctionscript.org over a year ago. :)
    http://www.actionscript.org/forums/showthread.php3?t=143111
    No one figured it out back then but I revived the thread and
    I think someone identified the issue:
    The SWF must have system focus for the blinking text
    cursor/carat to appear.
    In the browser, SWFs do not have focus until you click on it,
    or force focus using javascript's focus() function.
    What I don't understand is why the Flash Player in the IDE
    doesn't start out with focus -- it seems to start out with a sort
    of half-focus.
    The project I'm working now is in AIR, though. Again, it's
    surprising that the AIR SWF doesn't start out with focus, but I
    also have no idea how to programatically give the SWF focus from
    AIR.

  • How does ACR compute focus distance?

    Hello folks,
    In the recent versions of ACR, I've seen that it can include in the EXIF the focus distance from converted RAW files. I'm just wondering how it determines such information, particularly with Canon CR2 files. The focus distance seems to be accurate only on very long focal lengths (500mm and above). I have a 400mm lens and I noticed that I'm getting only any of 6.5m, 11.5m, or 76.6m as focus/subject distance.
    Can you guys provide me an idea as to how the the focus/subject distance is determined? For the type of photography that I do, this would be a very useful piece of information.
    Thank you very much.
    Mark

    Thanks, guys!
    @Jim:
    I'm using a Canon 40D . Indeed some of the focus points are on areas which might be farther than the subject, but they were not activated (since I used only the center point AF). I believe embedded focus distance should be based only on the active focus point/s.
    @ssprengel:
    Yes, it seems there is a predefined set of distances that are returned.
    Thanks for the link. I tried it and I'm still trying to figure out how the focus distance is determined based on the metadata (that was an awful lot!) retrieved. Of interest are the fields FocusDistanceUpper and FocusDistanceLower, but I couldn't find documentation about these fields in the web. The tool will be very useful. When I have the free time I can probably conduct some tests.
    @MadManChan2000
    Does it mean the camera embeds a rather rough approximation of this information?

  • How to determine logical database in a program?

    Hello guys!
    How to determine logical database in a program on Eclipse?
    I have not found any options:
    Thanks!

    Welcome to SDN
    Check the table RSOSFIELDMAP
    Assign points if useful
    Regards
    N Ganesh

  • Anyone know how to determine Macbook Air screen tech? Causing migraines

    Hi There,
    Last year, I expereinced a lot of mild migraines which I've traced back to a new Macbook Air.
    At first I had no idea of the cause (diet, stress etc) but have noticed that my eyes feel uncomfortable looking at the screen of my Macbook Air (I don't have this issue with my Dell monitor).
    My eyes don't hurt per se, but I can detect a sublte jittering with the screen - which can turn into a migraine.
    After doing a bit of research, it seems like most (but not all) LCD and LED LCD displays use something called pulse-width modulation to control brightness but after calling Apple support, they told me my MBA doesn't use this technology.
    Does anyone know how to determine the underlaying technology in Apple displays so I can research the cauase of my headaches? I found a good Ukranian website (in english) that explained pulse-width modulation but it didn't really talk about other technologies.
    Any pointers in the right direction would be much appreciated.
    Cheers
    Ben

    What version of OS X are you using? If Yosemite, you need to update to 10.10.1 or higher.
    In any case, start by going to the editor preferences>general, clicking this button and restarting the editor:

  • How to determine whether a recordset is Empty or not ?

    Please see my snippet code below :
    <%     
         String sql="";
         String username="CDS";
         try
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con = DriverManager.getConnection("jdbc:odbc:Employees","","");
                Statement stmt = con.createStatement();
                ResultSet rs=null;
                   sql = "Select * from Employee where code='" + username + "'";
                   rs = stmt.executeQuery(sql);
                   rs.next();
                   if (rs==null)
                   %>
                        <jsp:forward page="Login.jsp?msg=Username not recognized"></jsp:forward>     
                   <%     
                else
                   %>
                        <jsp:forward page="Login.jsp?msg=Halo"></jsp:forward>
                   <%
              catch(ClassNotFoundException e)
                   out.println("Driver not found");
                    catch(SQLException e2)
                            out.println(e2.getMessage());
                            out.println("<BR>");
                            out.println("Wrong SQL Statement");
                            out.println("<BR>");
                            out.println(sql);
                            out.println("<BR>");
         %>How to determine whether a recordset has no result ?
    From the above code, i use if (rs==null) and that's not worked.
    Help me, guys.

    ResultSet rs = stmt.executeQuery(sql);
    if (rs.next()) {
    %>
        <jsp:forward page="Login.jsp?msg=Halo"/>
    <%
    } else {
    %>
        <jsp:forward page="Login.jsp?msg=Username not > recognized"/>
    <%
    }

  • How to get the focus in a Table Control

    Hello Experts,
                         I have a simple Table control in my screen . I want to know under which column my cursor is ? Basically i want to get the focus the table control . How can i achieve this  ?
    Thanks
    Vivek

    >
    Vivek Joshi wrote:
    > Hello Router ,
    >                      I do not want to set the focus , I want to get focus . User can click on any cell in the table and then press a button in the toolbar . Now in the event handler of the button i want to under which column User has set the focus .
    > I hope , I am clear now .
    > Thanks for your help
    > Regards
    > Vivek
    An yet you keep getting suggestions of how to set the focus.   I looked through the API documentation and I don't see anything that would suggest you can request to see where the current focus is.  Perhaps someone might still come along with a solution, but my hopes wouldn't be too high at this point.  I can pass the requirement onto Product Definition, as the use case does seem interesting.  Perhaps it is something we have even considered in the past. 
    But for now, there might be a better way to solve your problem.  It will probably mean redesign the interaction.  What exactly are your requirements?  Do you need to be able to get the data in a particular cell of table when a button is clicked?  Just throwing out some ideas here, but maybe just use the lead selection to select the row, but then have a button choice to choose the action associated with the column you want. A hack for sure - but it might work.  Also it doesn't help you right now, but in the near future update to NetWeaver 7.0, WDA does have a onColSelect event for the table.

  • How to get the focus at the end of text ?

    I am having applet with awt TextField component and some default text. (MSQ-)
    To have a focus to text field I am using :
    refnoTextField.requestFocus();
    But this gives focus at the biginning and not at the end of text. I want the focus at the end (i.e. after MSQ-)
    How to get the focus at the end of text ?
    any help ?
    manisha
    manisha

    public void focusGained(FocusEvent e) {
         if (e.getSource() == yourtextbox) {
         yourtextbox.setSelectedEnd(yourtextbox.getLength());
    try this thing - not sure if it'll work, but I figgured out how to apply it to my textareas for keeping the focus on the last line of the textarea..it might work for your textboxes..
    shrug

  • How to get the focus of particular UI Element

    Hi All,
    How to get the focus of particular UI Element in webdynpro Page,
    I have a page where i am creating a ALV, I want to get that keyboard focus is on that element is there or not?
    Can anyone please give some update?
    Best regards,
    Rohit

    I would suggest try invoking REFRESH of ALV on the ON_CELL_ACTION event.
    Below excerpt is from Thomas
    The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
    ON_DATA_CHECK:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
    This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
    You could also consider ON_CELL_ACTION:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
    It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
    if you want to capture & refresh on some hot key combination then refer to this thread
    [https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3760417]

Maybe you are looking for