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.

Similar Messages

  • How to determine which drive has the most recent backup?

    I have a few drives that contain backups of files. What would be the easiest way to figure out which of the drives has the most recent backup? When I sort by date, the folder shows one date, though the files inside show a different date? Is there a way to quickly check the drives to find which is the most recent?
    Thanks.

    the folder modification date isn't reliable, as is only tells of changed in the folder, but not in subfolders. there is no efficient way. I however highly suggest Time capsule, it is WAY easier and you can ask it not to sync the System data and/or applications, so it would prevent this hassle.
    You could try this: go to the first drive, type different letters, like a for instance, and see which file is the most recent document/folder.
    do the same thing on the other drives and compare.

  • How to determine which elements are queryable via Web Services QueryPage

    I am trying to query opportunities by associated opportunity product revenue records, but I continue to receive errors like "Unexpected text: = '9598015'".
    From reviewing the forums, it looks like this is when I am querying a field that is not defined to be queryable.
    Could someone please tell me how to determine which fields are queryable on a particular record type like this? I have tried using basic short text fields and indexed short text fields - but continue to receive the error message above.
    Thanks in advance.

    I found at least partial answers to my questions.
    MessageContext.getPropertyNames() can be used to see the properties on a given flow.
    MessageContext.getProperty(prop) can be used to get information for paroperties such as:
    prop=javax.xml.rpc.service.endpoint.address
    prop=wsdl.portName
    -- Frank

  • How to check which user has the privilege to execute a stored procedure?

    I am using Oracle 7 and I would like to check which user has the privilege to execute a stored procedure. How can I check it? Is there any view I can query for?
    Alex Hung

    Please check DBA_SYS_PRIVS.
    SQL> select * from dba_sys_privs
    2 where grantee='HARY';
    GRANTEE PRIVILEGE ADM
    HARY EXECUTE ANY PROCEDURE NO
    ....

  • How to determine which locale uses the specific process

    Hi,
    I would like to get to know which locale uses the specific process.
    I mean that when the process starts it should use the current system locale.
    Where I can check that information which locale are used by the running process?
    I ask because I would like to make sure that for example when the locale are French or Japanese the process/deamon use the current locale.
    Kind regards,
    Daniel

    VivaLaVida wrote:
    Hi,
    currently we are in the process of consolidating our databases. One of the neccessary steps is to figure out which user connects to the database at all. That's easy, we implemented a logon-trigger and log the collected information into a separate table.It could have been even easier by turning on the built-in audit feature.
    If a user with objects (e.g. tables, views, procedures) exists - but this user never connects to the database - does that automatically mean that these objects are not used at all? No need to say that this is not true. But how can we figure out if a connected user has selected an object of this user?audit would be a good choice.
    Our porblem is that we have alot of schemas in our database - but the developers don't know if this schema is not used by an application or not (sad but true).Not sure what developer will do with used/not used application.
    To enable auditing would be one choice to figure out if an object was ever used or not. What's wrong in auditing ?
    Even though audit may have a footprint on performance, that would probably be less costly than any custom solution.
    Nicolas.

  • How to determine which user has an Access 2013 databse open

    How can I tell which user / PC has opened a Backend Access database?

    If the file is stored on a server and you have access to it, you could check in Computer Management, then go into System Tools, Shared Folders, Open Files, and you should find the file listed there along with which user has it open currently.

  • How to determine which application has focus in Windows

    Hello all-
    I'm trying to work around the "Labview freezes when there is large data on the clipboard known issue" (http://forums.ni.com/t5/LabVIEW/Labview-freeze-when-accessing-a-custom-menu-with-data-on-the/m-p/200...) and one thought is to try to determine if Labview has focus, and if it does then clear the clipboard.  If Labview doesn't have focus, then let the user use the clipboard.  This would be a good work-around because it would let the users paste screen shots and such into notes files and wouldn't risk a nasty clipboard/ menu/ freeze-crash.
    My initial search for determining windows application focus, came up empty though.  This old thread (from 2005) pretty much covers it:
    http://forums.ni.com/t5/LabVIEW/Is-there-a-simple-way-to-programatically-tell-which-VI-window/m-p/20...
    The "Is Frontmost' property does not do it.  I need to determine if Labview has focus, as opposed to Windows, notepad, firefox, etc.  I also reviewed the commad prompt commands and didn't find anything immediately helpful there either.
    Any ideas?
    Thanks,
    Casey
    Solved!
    Go to Solution.

    Christian-
    That's perfect!  By using GetForegroundWindow, GetWindowTextA and GetWindowFileNameA in user32.dll I can detect which window has focus.  If Labview has focus then I programatically clear the clipboard so the user can still use it when not clicking on Labview windowns, but also we do not risk a freeze and crash because of the clipboard/ freeze bug.
    I briefly thought about using the .NET versions of these functions, but because that would have forced an upgrade to at least .NET framework 3.0 for all of my user computers, I decided on the unmanaged user32.dll.
    Thanks for the suggestion.  I think I'm pretty close to a work around here that should last me until they fix the clipboard/ freeze bug.
    Thanks,
    Casey

  • How to determine which RAC-instance the appl. is logged onto?

    Dear all,
    I need to have my application server determine which RAC-
    instance is currently active (logged onto). I have a
    tnsnames.ora file with a primary-, and secondary RAC-
    instance configured, and Failover/Failback between the
    instances work fine. However, I would be interested in
    determining which instance I am curently using.
    Does the Oracle Net Protocol have support for letting me
    "read" this out, or...?
    Thanks.
    Regards, Eldor R.

    Thank you for the prompt reply.
    Is there, in the Oracle Net Protocol, available
    function(s) for reading out this information
    directly without "parsing" the trace file?
    I would like to read out this information from my
    application run-time.
    Thanks.

  • How to find which Port has the highest traffic (both in/out) in switch

    Hello,
    I have a 3550 switch with 48 port having 12.1 code.
    Need to know which port is causing the highest traffic , i mean to track which user is downloading/uploading the most.
    I was able to track this in CATOS with the command sh top and that will tell the port, but in IOS based switches i was not able to find
    Can some one help.

    You can try with the following command:
    show interfaces summary
    Output shows the traffic for all ports instead of the top one only, but you can find the top from this output. Or you can install an MRTG or Cacti for monitor the used bandwith.
    bye
    FCS
    Please rate me if I helped.

  • JS: Get Control that has the Focus and paste something into it

    Hi,
    I want to implement some clientside code that gets the control that has the focus and copy some text into it.
    Can this be easily accomplished?
    Thanks
    Sven

    Hi,
    According to your post, my understanding is that you want to get the focus element via JavaScript.
    We can use the document.activeElement to get the current active element.
    http://stackoverflow.com/questions/497094/how-do-i-find-out-which-dom-element-has-the-focus
    http://stackoverflow.com/questions/11277989/how-to-get-the-focused-element-with-jquery
    Then you can use the obtained focus element to paste text into it.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
    Jason Guo
    TechNet Community Support

  • How does DIADEM import TDMS files? How gets every channel his number and groupindex? How can I determine which channel has which groupindex and number?

    I store different channels in a TDMS file.
    I like to have a time channel at the first position with group index 1 and number 1.
    When I read the TDMS file with DIADEM the time channel (Float64) is on a differernt position, and the channels are not sorted alphabetically.
    Here are my questions:
    How does DIADEM import TDMS files?
    How gets every channel his number and groupindex?
    How can I determine which channel has which groupindex and number?
    Best regards
    Joerg

    Hi Jörg,
    i suppose that you´re programme whose create the *.tdms file is writing on false position. Try to create datas with timechannel on first indes in diadem, then save it and then open it again. you see that all is correct. So please tell me what programm in what version do you use and please attache it here.
    Did you use the library for creating *.tdms files like in the link ?
    http://zone.ni.com/devzone/cda/tut/p/id/6471
    Here you find the gtdms_8.x.zip - when you extract it and opened the *.llb you find vi´s for all functions e.g. writing 2d array of strings to *.tdms file
    when you open the subvi´s then you see how created and writing datas/structure to *.tdms files. Because *.tdms is binary you can´t see structure with open it in editor.
    When you don´t have Labview you can use the 30 days test of current version 8.5 under following link
    german version download link
    https://lumen.ni.com/nicif/d/lveval/content.xhtml
    english version download link
    https://lumen.ni.com/nicif/us/lveval/content.xhtml
    Hope it helps
    Best Regards

  • How to determine which Windows application has focus

    I'm new to JAVA and new to programming. I hope someone will help me out. I'm trying to write a simple JLink program (JLink is a JAVA API for Pro|Engineer, a CAD design program). In part of this program I need to determine if Pro|E has focus. Is there some way to use JAVA to determine which actively running Windows application has focus?
    I basically want my program to pause when focus changes to another program. For example: While Pro|E is active and has focus the program runs, when I select an Excel window, or Outlook, or Notepad or any other window my program will pause until focus is returned. I just need to determine which window within Windows has focus.
    I hope I have explained this properly. I searched the internet for an answer but found nothing. I did come across some references to JNI, but I'm not sure what that is or how to use it.
    Thank you!

    I just need to determine which window within Windows has focus.No, you don't. All you need to determine is whether your application has the focus. If it doesn't, then some other application does, but it's really irrelevant which one does. All that's relevant is that your application doesn't have the focus and hence it should pause.

  • How  can i determin which tab has been clicked??

    hi there
    how do i determine which one of the tabs in a tabbedPane has been clicked? do i add ActionListener to the tabbedPane or its sub JPanel?

    I import them all, it finallly compiled, but I am not sure if they are ok. here is the codes
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    TabbedPane = new JTabbedPane();
    TabbedPane.addTab("Easy", easyTab);
    TabbedPane.addChangeListener(new ChangeListener()
    public void stateChanged( ChangeEvent ce )
    Object source = ce.getSource();
    if (source == "Easy")
    currentTab = "easy";
    does it look all right to you?

  • How to find out which user has the permission to execute startsap ?

    Hi All
    How do I find out which user has the permission to execute the startsap and stopsap? Do I control the permission on those script using windows standard authorization? For example: only allow certain user have the read and write permission?
    Thank you.!
    Vincent Lo

    Well to me this is really weird question..
    <b>noone un-authorized should have access to OS on your system</b>
    If this is valid you do not need to solve problems who can and who cannot start/stop SAP, because if you want to prevent some users from shutting down the SAP you have really hard job to do - there are many ways how to kill the SAP (for example killing relevant process from task manager, killing of database, messing with services etc.) - yes, this is harmful way of stopping SAP, but we are talking about attack, right? I would contact some Windows specialist to help you disable all the ways how to harm the running SAP. But still after that - there are many files that can be modified/deleted so SAP will crash after restart - you need to protect them too, etc.
    In case you take the first assumption as granted (and you really limit access to this server) you do not need to worry who can stop or start SAP - at the other hand it may be handy to be able to start/stop SAP from other users - for this you can run the stop/start script "under different user".
    But to answer the question - to me this is question just of access control (but really never tried that myself):
    <a href="http://technet2.microsoft.com/WindowsServer/en/library/c6413717-511e-42bd-bd81-82431afe4b2a1033.mspx">Permit or restrict access to a snap-in for a domain</a> (or see other related links down there on this page)
    Please award points for useful answers.
    Thanks

  • How to determine which chipset my Satellite L300/700 has?

    I have a SATELLITE L300/700 (PSLB8A-047004). The User Guide covers several models. It indicates that the chipset determines which memory modules I need for a memory upgrade. How do I find out which chipset I have, please?
    Kev.

    > I'm still curious about how to determine which chipset I have - any thoughts?
    Go to the device manger and click on IDE Ata/Atapi controllers:
    http://img814.imageshack.us/img814/7321/chipset.jpg
    There you will see your chipset installed on your laptop. In my case, as shown on the screenshot is Intel ICH9m

Maybe you are looking for

  • Reading files and directory from a directory

    ublic static void readFromDirectory(String dirName) {           // stop word ArrayLists           ArabicStop();           EnglishStop();           FrenchStop();           SpanishStop();           DutchStop();           File dir = new File(dirName);  

  • What are the new multitouch functions?

    What are the new functions, and can MBP's with multitouch be upgraded to take advantage of them?

  • Mapping Null fields.

    Hi all, I’ve configured an IDOC-to-File scenario with the IDOC MATMAS. The file generated uses the ‘nl’ as the record delimiter and #! as the field separator. Everything works fine except when the IDOC has null fields. In these cases the communicatio

  • The Real Question, Sharing iMovie With iDVD?

    With iLife 08, sharing to iDVD was a pixelated mess when played back on a DVD player. They stated that they changed this I think? Is this true? Does iMovie 09 share with iDVD like iMovie 06 to iDVD results?

  • How can i change bookmarks text colors, not toolbar text color.

    I know how to change color of toolbar text but still want to change the text color of bookmarks.