How can I call actionListener using JavaScript

Dear Programmers
I have to use javascript in order to call a specific actionListener when a window is close. Therefor I inserted the following code to the jsp:
<script type="text/javascript">
window.onunload = function(){......};
</script>
But how can call a specific actionListener? I saw that I can use submit(), but this method doesn't perform any actionListener. I didn't find where the actionListener is specified after doing "view source" on the browser.
Please help me

Hello,
I think you can do this:
<h:form id="formId">
<h:commandButton id="buttonId" actionListener="..." />
Then you can call:
document.forms.formId['formId:buttonId'].click();
to invoke the action listener. If you don't want to display the commandButton on screen, you may apply a css style to hide it.
Billy

Similar Messages

  • How can I call a custom javascript function when clicking on cfgrid cell.

    I would like to call a custom javascript function when
    clicking on a cell in an cfgrid (of html format). The closest thing
    I can find is to use the HREF="" attribute, but it doesn't seem to
    work with javascript inside it.
    Simple example:
    <cfgridcolumn name="Foo" header="Foo"
    href="javascript:customFunction(#ID#);">
    Do I need to tap into the underlying Ext JS funtionality? If
    so, where can I start?
    Thanks!

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How can Access mysql data using JavaScript

    Hi Friends,
    Could u please tell how can i access data from mysql using Java Script..
    please help me on this ..
    thanks

    Is there any another possible ways..
    My problem is ..
    i want display svg graphic file by getting the graphic attribute values from database ,then i will generate DOM ... by using Servlet ..
    Here my problem is whenever changes is made in the data base (That is graphic attribute values) it should modifies the svg images..without regenrating the whole DOM( svg file)
    please give me some suggestion on this .if any otherways is there for solving this problem..
    thanks

  • How can I set CameraRAWOpenOptions using Javascripts in Photoshop CS6?

    I have been unable to set CameraRAWOpenOptions in scripts that worked fine for me in Photoshop CS5 but now do not work in Photoshop CS6.  There are no error messages when I run the scripts, and they appear to finish okay, but the images come out unadjusted.  Below is the essence of how I'm trying to do it.  When I run these scripts in Extendscript (CS5 or CS6 does not make a difference), Photoshop CS6 simply uses its own default (saved) settings, but CS5 would allow the overrides.  I did change the default settings in CameraRAW in CS6 to use the default lens correction profiles available from the EXIF data, and I'm wondering if that rendered the script unable to change any of the rest of the settings.
    Here's how I have the code:
    var RawOptions = new CameraRAWOpenOptions;
    RawOptions.settings=CameraRAWSettingsType.CUSTOM;
    RawOptions.exposure=+2.00;
    RawOptions.vignettingAmount = 0;
    RawOptions.vignettingMidpoint = 0;
    RawOptions.contrast = 50;
    RawOptions.saturation = 0;
    RawOptions.shadows = 0;
    RawOptions.luminanceSmoothing = 0;
    var JPGopts = new JPEGSaveOptions;
    JPGopts.quality = JPEGquality;
    //Perform the loop through the files
    app.open(testListing[0], RawOptions, false);
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    for (var nfile = nstart; nfile < nstop; nfile++)
        app.open(testListing[nfile], RawOptions, false);
        FnameSave = new File(SavePath+"/"+testListing[nfile].name);
        app.activeDocument.saveAs(FnameSave, JPGopts, false, Extension.UPPERCASE);
        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

    I would collapse and expand the toolbar windows by using the double arrow icon?
    Doing this will almost give you your full screen?
    Or you can hit 'Tab' and it hides your tools when you don't need them?

  • Storing my subroutine name in a variable How can I call it using Perform

    Getting compilation error for the following code, Is this Possible at all:
    <b>DATA :</b> i1 TYPE i, i2 TYPE i, res TYPE i.
    i1 = 1.
    i2 = 2.
    data subroutinename type string.
    subroutinename = 'SUM'.
    <b>PERFORM</b> (subroutinename) USING i1 i2 CHANGING res.
    WRITE:/ res.
    *&      Form  sum
          text
         -->P_I1  text
         -->P_I2  text
         <--P_RES  text
    <b>form</b> sum  using    p_i1
                       p_i2
              changing value(p_res).
    p_res = p_i1 + p_i2.
    <b>endform.</b>                    " sum

    Dynamic routine name is only supported in call to external subroutines. Use it like this -
    <b>
    REPORT  ztest  .
    DATA : i1 TYPE i, i2 TYPE i, res TYPE i.
    i1 = 1.
    i2 = 2.
    data subroutinename type string.
    subroutinename = 'SUM'.
    PERFORM (subroutinename) IN PROGRAM ZTEST USING i1 i2 CHANGING res.
    WRITE:/ res.
    *& Form sum
    text
    -->P_I1 text
    -->P_I2 text
    <--P_RES text
    form sum using p_i1
    p_i2
    changing value(p_res).
    p_res = p_i1 + p_i2.
    endform. " sum</b>
    You above program name should be  ZTEST.
    Cheers.
    ( Dont forget to reward if answers were helpful )

  • How can I call a web service using JAVAscript in LCD

    hi guys,
         I know it can call a WSDL in LCD, but I have not any WSDL web service , and I have a REST web service ,how can I call this REST web service in LCD? I checked some documents and found nothing...if it's possible that it can call a REST web service using JAVAScript code, I mean I can program some code to call this web service ?
    thanks,
    Jesse

    Hi Jesse,
    You can do GET, PUT and POST using FormCalc, so you should be able to access a REST web service. 
    There is a example of accessing a RSS feed in this thread, http://forums.adobe.com/message/5695433#5695433
    Regards
    Bruce

  • Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Is there a way that you can have two different text fields (email, phone) that one at least one of them must be completed before submitting the form? Can it be done using javascript in the validation tab? if so, how?

    Here is one solution:
    // mouse up action for submit button;
    function GetField(cName) {
    // get field object for cName field with error checking;
    var oField = this.getField(cName);
    if(oField == null) app.alert("Error accessing field named " + cName + "\nPleae verigy field name, spelling and capitalizeation.", 1, 0);
    return oField;
    } // end GetField function;
    var oPhone = GetField("phone");
    oPhone.required = oPhone.value == oPhone.defaultValue;
    var oEmail = GetField("email");
    oEmail.required = oEmail.value == oEmail.defaultValue;
    if(oPhone.required && oEmail.required) {
    app.alert("Missing required fields.", 1, 0);
    } else {
    app.alert("Submitting form", 3, 0);
    // additional code for submission;

  • How can we call the method of used controller?

    Hi All,
       i created two WDA Applications.( like YWDA1,YWDA2 ) . i am using the component WDA2 in WDA 1.and displaying the one view of WDA2 as popup window in WDA1 on action of one of the input element in the view of WDA1 by using the method l_window_manager->create_window_for_cmp_usage
    I have a button on the view of WDA2 which has appear in the popup window...how can i call the method which has binded to that button....and where should i code that...and i need to assign selected value in the popup window to input elemetn of view  WDA1
    Please help me to resolve this....
    Regards,
    Ravi

    You can not directly call view's event handler from other component.
    create a method in component controller of the second component and in the button click call the component controller method. ( also make the method as interface so that you can call it from other components )
    Now, you can call the interfacecontroller's method
    DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI__VSTX_REBATE_REQ_WD .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_<comp usage name>( ).
      l_ref_INTERFACECONTROLLER->Save_Rr(
        STATUS = '01'                       " Zvstxrrstatus
    save_rr is the method of second component controller

  • How can i cancel the using of "Only calls for emergency?"

    How can I cancel the using of "only calls for emergency?"

    In the USA, you cannot.  I believe it is an FCC requirement that all cell phones be enabled to dial 911, even if they do not have an active contract or prepaid service assigned to them.

  • HT1937 How can I get to use my phone?  Much of it appears to be set up but when I try and make a call it tells me I have not been given access to this service

    How can I get to use my phone?  When I try and dial out it says:  'You have not been given access to this service'

    Have you chacked with your carrier.  The message you are getting seems to relate to a carrier issue and not something to do with the phone itself

  • How can I call a Jscript function from XML, which is written seperatly outside the xml file

    Dear All,
    I have made a SharePoint ribbon button which should display an alert message with SharePoint custom list
    ID information. But it has problem for calling the Jscript methods, It may be a XML tag mistake!!! Unable to
    find the error in code line!!!, can somebody please tell me this error by referring my code snippet????
    It is a farm SharePoint solution I have kept the Jscript file in mapped folder named "Layouts"
    It  is showing the error as : JavaScript runtime error: The value of the property 'myFunction' is null or undefined, not a Function object
    That means, as I understand the control is not moving or not calling the function from JScript file....why it
    is so...not able to debug JScript or xml using Visual Studio that makes my effort tedious!!!
    Code:
    Elements.xml
    <CommandUIHandlers>
    <CommandUIHandler Command="ShowAlert" CommandAction="javascript:retrieveListItems()" EnabledScript="return true;"/>
    </CommandUIHandlers>
    <CustomAction Id="Ribbon.Library.Actions.Scripts" Location ="ScriptLink" ScriptSrc="/_layouts/RibAlert.js"/>
    </Elements>
    RibAlert.js
    <script>
    var siteUrl = http://A5-1224';
    function retrieveListItems()
    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Measurements'); //getByTitle('Custom List');
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
    '<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
    this.collListItem = oList.getItems(camlQuery);
    clientContext.load(collListItem);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    </script>

    Hi,
    I suggest you write an alert() in your function to check whether it can be executed first.
    If alert() is ok, then it would be an issue of the code with Client Object Model, you can take a look at the link below about How to retrieve List Items Using JavaScript:
    http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
    If alert() can’t be executed, then please check whether the steps of created ribbon button is correct.
    The links below about how to add a custom button to the ribbon:
    http://aarebrot.net/blog/2010/09/adding-a-custom-button-to-the-ribbon-using-a-feature-in-sharepoint-2010/
    http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-create-custom-button-in-sharepoint-2010-ribbon-user-interface/
    https://pholpar.wordpress.com/tag/custom-actions/
    What’s more, there seems no query succeeded handle function in your code, please take a look at the link provided above for a reference.
    Thanks
    Patrick Liang
    TechNet Community Support

  • How can we call "SP.UI.Notify.addNotification" methods in sharepoint designer page(.aspx) load without any onclick control?

    Hello Friends,
    How can we call "SP.UI.Notify.addNotification" methods in sharepoint designer page(.aspx) load without any onclick control?
    Scenario: When i was open my page i need to show below script,But here i used button control.
    <script type="text/javascript" src="/_layouts/14/MicrosoftAjax.js"></script><script src="/_layouts/14/sp.runtime.js" type="text/javascript"></script>
    <script src="/_layouts/14/sp.js" type="text/javascript"></script><script type="text/javascript">
    var strNotificationID;
    function showNofication()
     strNotificationID = SP.UI.Notify.addNotification("<font color='#AA0000'>In Progress..</font> <img src='/_Layouts/Images/kpiprogressbar.gif' align='absmiddle'> ", false);
    </script>
    <div class="ms-toolpanefooter"><input class="UserButton" onclick="Javascript:showNofication();" type="button" value="Show Nofitication"/> </div>
    Thanks
    Reddy

    Hi  Reddy,
    You can use the window.onload method for achieving your demand as below:
    <script type="text/javascript">
    window.onload=function(){
    </script>
    Hope this helps!
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • How can I call my chart in Forms6i on When Button Press Trigger?

    Hi Friends,
    I have make a chart in Graphic Builder 6i and save on path C:\graph\test.ogd
    Now I want to run this Chart from Form6i on When Button Press trigger.
    I have call my report in forms using this command on When Button Press trigger.
    Run_Product(reports,'C:\Cheema\Qdir_store\reports\pmms\sec_backlog',asynchronous,runtime,filesystem,TO_CHAR(NULL));
    So tell me How can I call my chart in Forms6i?
    Please reply me on urgent.
    Thanks,
    Shahzad

    Just to recall after a long break of couple of years..... Pls check out if not wrong.
    First of all you need to embeed the chart object on your layout window and make it visible = FALSE. This is a design time work. In the button press event, show the chart object by setting the visible property = TRUE.
    Note, i could not paste u the sample code as i don't have forms installation on my PC. The above states is a logic you can apply.

  • How can I call AM from another page

    Hi,
    I have come across a situation which I am not sure how to solve it. Here is the issue. I have a custom requirement to add another page to an already existing custom page. The first page used to hold the data and commit buttons however because of requirements, we want users to add some comments on the second page and then save the data. In other words the save button is now suppose to move to the second page.
    The dilemma I have is that the method that used to be called from the PFR CO of Page 1 was linked to page 1 AM which had that commit method.
    I still want to re-use the method from the Page 1 AM since there is a lot of logic involved. How can I call that method while I am in my second page from my CO?
    I am using setForwardURL and I am retaining AM from page 1.
    Also, if this is not feasible what are other alternatives. Any ideas would be appreciated.
    Edited by: user501998 on Jan 7, 2010 12:21 AM

    Hi,
    Can you give me an example? I mean do I just call the AM like in the example below...in my PFR...of Page 2 Controller. I thought this would be giving me an error method not found or something since it would be looking at the AM of my current page. I will try it and see but if there is another syntax can you please provide it.
    Thanks
    Partial code from PFR of Page 2
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if(eventName.equals("save"))
    if ( respName.endsWith("Admin") )
    am.invokeMethod("commitTransaction"); --- This is the AM Method in Page 1...
    } else
    throw new OAException("Shipper successfully updated.", OAException.CONFIRMATION);

  • How can i call a DLL file from labview?

    Iam using a sensoray 2601 module.It is given as DLL file(S2600.DLL).How can i call this function from LabVIEW?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    As far as I can tell problems might occur with the call library function node if the the DLL from visual basic is actually an ActiveX dll if that is the case it seems calling the dll by using the Invoke node is the way to go.
    Have a look at this 
    /sletten

Maybe you are looking for