How to set item focus from javascript

Hi all,
i need to validate a form item with javascript to check required fields.
The function is :
function isRequired(field) {
if ($v_IsEmpty(field)) {
alert('The field is required!');
html_GetElement(field).focus();
return false;
return true;
Also in the form item attribute i added :
onChange="isRequired(this);"
If the filed is null, i see the alert but the focus is on the next item! How can i set the focus on the null item?
Thanks,
Sergio

Denes, thanks for your answer.
I tried
html_GetElement($x(field).id).focus();
but doesn't work.
Also, if in the form item attribute i add
onBlur="isRequired(this);"
instead of
onChange="isRequired(this);"
the javascript works with both solution (html_GetElement(field).focus(); or html_GetElement($x(field).id).focus();) with IE7 but doens.t work with Firefox 3.0.1.
Please help me, please
Sergio

Similar Messages

  • How to set a bookmark from javascript?

    A web site is working using POST (not GET), so all the pages have same URL. With previous versions window.sidebar.addPanel(page_title, url,''); worked, no it does not. Any way to achieve the same in current FireFox version?

    The above posted bookmarklet redefines the add_bookmark() function that is called by the CreateBookmarkLink() function.<br />
    So what happens when you run this bookmarklet code is that the page reloads with the URL (location.href=url) that is specified in the CreateBookmarkLink() function.
    That way you can click the star to bookmark the current page with the correct URL.
    *http://hybridjava.com/HJ_Sample/?HJ_page=com.HybridJava.Sample.NiceFrame_P
    *http://hybridjava.com/HJ_Sample/?HJ_page=com.HybridJava.Sample.NiceTable_P
    *http://hybridjava.com/HJ_Sample/?HJ_page=com.HybridJava.Sample.Components_P
    *http://hybridjava.com/HJ_Sample/?HJ_page=com.HybridJava.Sample.Shared1_P

  • How to set the focus to a first element in oracle apex 3.2.1  and 3.1.2.00

    Hello ,
    I am using oracle apex 3.2.1 in development env. How to set the focus to a first element of a page.
    thanks/mahesh

    Hi,
    This might help
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/bldr_pgs.htm#CJGJDHCI
    Find "Cursor Focus" from page Display Attributes
    Br,Jari

  • How to set the focus to the tabbed pane title?

    Dear Friends,
    I'm using tabbed pane (JTabbedPane) in my application. I have 2 tabbed panes and each contain some text fields and buttons.
    In first tabbed, I have 2 text fields, OK and Cancel buttons. I have to set the focus to the title of the tabbed pane after it lost focus from the Cancel button (focus has to move from Cancel button to tabbed pane title by pressing tab key).
    Could anyone please tell me how to set the focus to the tabbed pane title?
    Thanks in advance,
    Sathish kumar D

    Thanks for your reply.
    Could you please tell me how to set focus for title of the tabbed pane throug FocusTraversalPolicy?
    because usually we set the focus for the component by requestFocusInWindow().
    for example set focust to the button OK,
    btnOk.requestFocusInWindow()likewise could you tell me how to set focus to Title of the tabbed pane?
    Sathish kumar D

  • How to set a language from LTR to RTL in illustrator cs4

    how to set a language from LTR to RTL in illustrator cs4.....plz help

    Mac or PC
    In either case the language has to be selected on the Mac go to the SystemPreference and language and text and select arabic as the language etc.
    That should do it.
    Oh, yes just in case you have to also select and arabic type face and it helps if you have a ME computer.

  • TS4006 how to set a tracking from the computer if someone stolen the ipod

    how to set a tracking from the computer if someone stolen the ipod

    Welcome to the Apple Community.
    You can only locate your device when it is logged into iCloud and 'Find My Phone' is enabled, additionally the device will need to be switched on and connected to a wifi or cellular network.
    Unfortunately, you cannot activate iCloud or 'Find My Phone' remotely.

  • How to set the focus on the new added line in ALV list (OO)

    Dear Friends,
    I have an ALV list based on OO(using alv_grid->set_table_for_first_display), when I click the 'new' button to add a new line, the mouse arrow is always pointing to the first line - not the new created line for user to input!!.
    So how to set the focus (mouse arrow) on the new added line in ALV list for user to input it friendly?
    Thanks a lot!!

    Hello,
    To get the selected line row first we have get all the rows in the internal table.
    When u click on the button when it is creating the new line we have to pass the row number to the call method
    CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->get_selected_rows
       IMPORTING
          ET_INDEX_ROWS  =   <internal table of type LVC_T_ROW > (obsolete)
          ET_ROW_NO      =   <internal table of type LVC_T_ROID > .
    CALL METHOD<ref.var. to CL_GUI_ALV_GRID>->set_selected_rows
       EXPORTING
          IT_ROW_NO  =  <internal table of type LVC_T_ROID>
       or alternatively
       IT_INDEX_ROWS  =  <internal table of type LVC_T_ROW>
          IS_KEEP_OTHER_SELECTIONS  =  <type CHAR01>.
    http://help.sap.com/saphelp_erp2004/helpdata/EN/22/a3f5ecd2fe11d2b467006094192fe3/content.htm

  • How to set up printer from ipad?

    how to set up printer from ipad?
    Johs.

    iOS AirPrint Printers  http://support.apple.com/kb/HT4356
    How to Print from Your iPad: Summary of Printer and Printing Options
    http://ipadacademy.com/2012/03/how-to-print-from-your-ipad-summary-of-printer-an d-printing-options
    Print from iPad / iPhone without AirPrint
    http://ipadhelp.com/ipad-help/print-from-ipad-iphone-without-airprint/
    How to Enable AirPrint on a Mac and Use Any Printer
    http://ipadhelp.com/ipad-help/how-to-use-airprint-with-any-printer/
     Cheers, Tom

  • How to set iframe src from java dynammically

    Hi,
    Iam calling a servlet from jsp and servlet calls the databse query and returns the value,
    in my jsp i have ifrme, i want to change the source of iframe from java depends on the result from database , and the result must display on the iframe can any one tell me how to do this

    aurelian_cl wrote:
    I need to know how to set environment variables from java
    I want to set from java for example the environment variable "TestVar" with the value "TestValue"!1) That functionality does not belong in an application. You're trying to set environment variables, which are global across all applications, at either the user level as a whole, or across the entire machine (system level). Or, if you're only trying to set a variable active for the current process, you don't need to do that.
    2) Environment variables are not a platform-independent entity, and are thus against the nature of Java.
    My gut feel is that you are designing something in a backwards way, so my point is mainly to point that out, not to try to help you solve that particular problem.

  • How to call SOAP API from JavaScript

    Hi,
    I'm trying to call the SOAP API to get statistics about emails. Are there any examples on how to call the API from JavaScript?
    Here is a link to my original question about using the REST API. REST API URL for email statistics
    Thanks,
    Tim

    Tim,
    In order to consume a SOAP API I recommend you use something other than JavaScript.
    Any platform can offer you a good SOAP client should be OK. (.Net, Java, php, Ruby, python).
    I didn't see anyone successfully used javascript and consume the Eloqua SOAP API.
    I know you can create a SOAP client in Java script but it will be too much work to handle the Eloqua response in some cases.
    Regards,
    Daniel

  • How to set item #2 in a JCombobox as selected default ?

    JCombobox always set item #1 as default.
    How to set item #2 or #3 or another # (except #1) as selected default ?

    hey,
    there is a method called setSelectedIndex(int index)
    pass the index which u want to get selected by default.
    Call this method after loading the data to the comboBox
    for ex cbo.setSelectedIndex(1);
    Hope this helps
    Nagaraj

  • Set item value from application level item

    Hello,
    I'm using Apex 2.2.1.00.04. I've modified the Page "No Tabs" template so that I can have my own Form (which is submitted to an outside website). On this form, I create some hidden items:
    <form name="frmEPay" method="POST" action="some_website">
    <input type="hidden" id="i1" name="userId" value=&G_ID. />
    <input type="hidden" id="i11" name="timestamp" value="" />
    <input type="hidden" id="i12" name="hash" value="" />
    On this apex page, I have a javascript function which is called in the onload (basically, the ApEx webpage displays and then is redirected). Here's a snippet of that function:
    var appProc = new htmldb_Get(null, html_GetElement('pFlowId').value,'APPLICATION_PROCESS=PrepEPay',0);
    appProc.get();
    appProc = null;
    document.getElementById('i11').value = "&G_ECOM_TIMESTAMP.";
    document.getElementById('i12').value = "&G_HASH.";
    document.frm_infiNET.submit();
    As you can see, the function calls an application level On Demand process (PrepEPay). That process sets the values of the application level items G_ECOM_TIMESTAMP and G_HASH. After those App level items have their values, I want to take those values and apply them to the hidden items on my custom form. Unfortunately, it doesn't work how I have things currently. I've verified that the On Demand process is running(by viewing the Session report on the page). So my problem seems to be this: 1. Retrieving the values from the Apex application level items
    2. Setting those values to the values of my hidden items (on my custom form)
    I think the biggest reason why I'm having difficulties is because I have to do a lot of this in the template, since that is the only way to have a separate Form. Maybe my problem is that I don't understand how to reference the Apex application level item value from a different form?
    Thanks,
    Marty

    Marty,
    You are describing this as if you expect the substitution within "&G_ECOM_TIMESTAMP." and the other one to take place in some kind of lexical order, e.g., from the top to the bottom of the HTML. The replacements happen in the engine, before anything is sent to the page. Then the browser interprets language constructs such as javascript calls which in your case includes an ajax invocation of a server-side application process.
    You need to re-think the machinery here.
    Scott

  • How to Set Item limit for Picture library Slideshow webpart in SharePoint 2013

    Picture library Slideshow webpart is using the default view "All Pictures" and if I set a filter condition in the view, the images are displaying based on it but if I set an Item limit as "5" or any number in the "All Pictures"
    view it is not reflecting in the slideshow webpart.
    Any suggestion would be a great help as the users want to see only the latest 5 images in the slideshow webpart.
    Thanks & regards,
    Asha

    I don't think so there is any way to set a item count limit on Picture Library Slideshow web wart.
    Web Part setting only allows to provide library and View, In List view also you can only set Item Limit to be shown on the 'List View'. Slideshow web part take all the items in the list and show, view is only used to provide which field needs to be shown.
    There could be 2 options:
    - Write a JavaScript to limit the count, and in the view add Sorting by 'Created' date. You can get some example on how to modify "Library Slideshow web part" javascript here: http://blog.vgrem.com/2013/04/27/beyond-the-slideshow-web-part-capabilities-in-sharepoint-2010/
     This link does not have solution of what you want, but it gives a very well idea on what you can look and modify. It will not be that straight forward for sure.
     - Create a custom webpart, it could be a easier approach. As there are many slideshow Javascript library present, and through code you will just need do a query and pull data from library with required number of items to be shown.
    get2pallav
    Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.

  • How to get a value from JavaScript

    How to get return value from Java Script and catch it in c++ code. I have tried following code, but its not working in my case.
    what I want is if it returns true then call some function if it returns false then do nothing, so how to get those values in c++
    ScriptData::ScriptDataType fDataType = resultData.GetType();
    if (fDataType == kTrue)
           CAlert::InformationAlert("sucess");
           //call some function
                        else
                                  CAlert::InformationAlert("Error");
         // do nothing
    JavaScript Code:
        if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
               alert(value);
                return true;
      else
               alert ("SORRY");
               return false;

    How to get java script result into JSResult i m not getting it.
    I have wriiten follwing code in c++ :
              WideString scriptPath("\\InDesign\\Source1.jsx");
              IDFile scriptFile(scriptPath);
              InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
              if(scriptRunner)
                        ScriptRecordData arguments;
                        ScriptIDValuePair arg;
                        ScriptID aID;
                        ScriptData script(scriptFile);
                        ScriptData resultData;
                        PMString errorString;
                        KeyValuePair<ScriptID,ScriptData> ScriptIDValuePair(aID,script);
                        arguments.push_back(ScriptIDValuePair);
                        PMString paramkeyname1;
                        Utils<IScriptArgs>()->Save();
                        Utils<IScriptArgs>()->Set("paramkeyname1",scriptPath);
                        Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner,script,arguments,resultData,erro rString,kFalse);
                        Utils<IScriptArgs>()->Restore();
                        ScriptData::ScriptDataType fDataType = resultData.GetType(); // here i should get true or false which i m passing it from javascript code......not as s_boolean
                        if (fDataType == kTrue)
                                       //CAlert::InformationAlert("sucess");
                                     iOrigActionComponent->DoAction(ac, actionID, mousePoint, widget);
                        else
                                    this->PreProcess(PMString(kCstAFltAboutBoxStringKey));
    Java script code:
    function main()
           var scrpt_var;
           var scriptPath,scrptMsg;
           var frntDoc=app.documents[0];
           if(app.scriptArgs.isDefined("paramkeyname1"))
               var value = app.scriptArgs.get("paramkeyname1");
                alert(value);
                 return true; // i want this value i should get in c++ code...How to get these values in c++
           else
              alert ("Error");
              return false; // i want this value i should get in c++ code...How to get these values in c++

  • How to get FindAgain & FindPrevious from javascript OR other options

    Hi All, I'm trying to use the 'SearchResults -> Next Hit [Old]     'SearchSubmenu -> FindAgain' [New]
    Out of all these: Find | FindSearch | SearchSubmenu | FindAgain | FindPrevious
    Only 'Find' and 'FindSearch' works from javascript - None of others worked on Adobe 9 Pro:
    For example: app.execMenuItem("FindAgain") did not work and no errors on debugger,
    Please let me know, how I will be able to get to the next search item and previous search item from app.execMenuItem
    I even tried these two to include with priv restrictions: app.beginPriv(); app.execMenuItem("FindAgain"); app.endPriv();
    ========================================================================================
    I'm attaching the zip file that contains the two required files to view a pdf in a browser through html.
    History: I'm working on this to help a old aged home where they have touch screens and it is very difficult for some to identify a pdf tool bar buttons or use their pdf's efficiently.
    So, I was thinking about it for over six months and started two weeks back to really help them. Though I did not expect that it is going to make me purchase pdf 9 pro. I did. But, even after that with all these hours working on this, I could not get this working.
    I got few samples from Jeff's:    http://www.adobe.com/devnet/air/ajax/quickstart/scripting_pdf.html
    I did use these files and trying to get that only feature which is 'Find Next' and 'Find Previous'. In fact tried almost all 'AcroSrch.....  es
    In the html, I have hard coded a search string 'lorem' with #search=lorem..., I plan to get a new search string from other html page. I will do it later.
    As per Jeff, I had that 'Edit java Script' inlcuded in the pdf file.
    If you get a chance please check the attachment. (Open test.html in the browser)
    IS THERE ANY OTHER WAY IN THIS WHOLE WORLD TO GET THIS 'FIND NEXT' and 'FIND PREVIOUS' to work? OR ANY OTHER IDEAS THAT WOULD GET THIS WORKING. THANKS A LOT. OR ATLEAST IN OLDER VERSIONS, IF POSSIBLE, ANY IDEAS THAT WOULD BE MOST WELCOME
    ========================================================================================
    if you can think of any ideas which can make this happen, it can be any even to buy some additional software or option to add some buttons in pdf itself that can do the job or sending the keyboard shortcuts commands like 'Ctrl+G' and 'Shift+Ctrl+G' [which does the same like 'FindNext' 'FindPrevious'] to the pdf object from the html button action would help,

    Both app.execMenuItem("FindAgain") and app.execMenuItem("FindPrevious") work just fine in Acrobat 8 Pro (from the console), but only after manually running the Find version once.
    Think about it, all that JS does is call these functions. So calling Find from JS will basically not do anything because you can't specify to it what to search for. Even typing the string you want to search for in the "find" field doesn't work.
    If you want to find words in a file using a script you will need to use getPageNthWord.

Maybe you are looking for

  • Upload MR results which already billed from Legacy System to SAP

    Hello Experts, We want to implement ISU-Water . Before Implementing SAP, we want to Upload Last Year's MR results (From the Previous system..) ,to let SAP use these results as a basis for Estimation. To have these Meter Readings in DB tables, I proba

  • SAP license key error:  no valid license found:  cannot log into SAP GUI

    I deleted temp license from slicense on SM box, since I had already installed new digital license from SAP.  Well, later I tried to log in again and was locked out.  After some research, I found "sap license check failed" in the log files, java will

  • Is this a bug with grouping sets?

    Version is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production SQL> with data as   2  (select rownum r, 'X' x, 1 n from dual connect by rownum <= 10)   3  select x   4       , sum(n) s   5       , (select sum(1) from dual whe

  • Force Application to choose network interface

    Hi Everyone, My target computer as two NIC, Eth1: IP: 192.168.0.14 Mask: 255.255.255.0 GateWay: 192.168.0.254 Eth2: IP: 10.2.5.168 Mask: 255.255.0.0 Gateway: Blank Eth1 is supposed to be connected to the network, Eth2 is only connected to a camera. I

  • Photoshop Elements 8 - can't deactivate

    I am unable to deactive Photoshop Elements 8.  Don't see that version on any list.  I had to install a new hard drive and all software was wiped out.  When I reinstall Photoshop on the same computer it does not recognize that it is the same PC.