Click af:commandButton from javascript

Hey
I'm having the same issue as you. I want my session to be destroyed when a users closes the window.
As onUnload triggers every time you navigate away from the page I can't use it. Instead I'm using the following Js code:
<script type="text/javascript">
window.onbeforeunload=function(){
if (window.event.clientY &lt; 0 &amp;&amp; (window.event.clientX &gt; (document.documentElement.clientWidth - 5) || window.event.clientX &lt; 15) ) {                       
document.getElementById('hiddenButton').click();
</script>
my af:commandButton has the following structure :
<af:commandButton text="" id="hiddenButton"
onclick="if (confirm('#{res['sag.generales.cerrarSesion']}')) {window.document.all['logoutFrame'].src='../servlet/LogoutServlet';window.setTimeout('closeWindow()',100);}"/>
<af:regionDef var="attrs">
But is sadly not working. When I close the page nothing executes.
On the other hand if I use a regular button instead of an commandButton I'm able to click it via javascript
<input type="button" name="theSubmitButton" id="hiddenButton" value="Button" onclick="alert('The button was clicked.');"/>
i mean, in this case when i close the window i get the message "The button was clicked". But if I use the same code I have on the af:commandButton onclick for closing my session nothing happens.
I'm super new to adf and java so maybe I'm missing something obvious.
Thanks a lot for your hepl. I mean it :)
Edited by: loskiorama on Jun 20, 2011 8:54 AM

Hey!
Thanks for your help guys!
Frank:
I tried as you mentioned
window.onbeforeunload=function(){
if (window.event.clientY &lt; 0 &amp;&amp; (window.event.clientX &gt; (document.documentElement.clientWidth - 5) || window.event.clientX &lt; 15) ) {                       
var button = AdfPage.PAGE.findComponentById('hiddenButton');
AdfActionEvent.queue(button,true);
<af:commandButton text="" id="hiddenButton"
onclick="if (confirm('#{res['sag.generales.cerrarSesion']}')) {window.document.all['logoutFrame'].src='../servlet/LogoutServlet';window.setTimeout('closeWindow()',100);}"/>
but when i close the window. the commandButton onckick in not executing. Maybe is because as I'm closing the window, the event doesn't get queued in time. i don't know
Vinod:
I'm using a onlcik on my af:CommandButton button
<af:commandButton text="" id="hiddenButton"
onclick="if (confirm('#{res['sag.generales.cerrarSesion']}')) {window.document.all['logoutFrame'].src='../servlet/LogoutServlet';window.setTimeout('closeWindow()',100);}"/>
When I click the button it works fine. but what I want to do is click this same button from javascript
Thanks so mucho for your help guys. Hope you can keep helping me find a solution

Similar Messages

  • [SOLVED] ADF - How to disable/enable CommandButton from JavaScript

    CommandButton is rendered as a image in HTML and image does not have disabled property in JavaScript. Is there some other way to dynamically change render property of ADF/CommandButton without auto submitting?

    - if you don't mind that it doesn't 'look' disabled, you can have an onClick return false
    - you might be able to hide it by putting it in the custom 'div' tag someone recently posted on this forum and then using visibility:hidden from the javascript
    - or you could put it in the div tag, or use a seperate div tag and float that on top, and play around with opacities
    - or you could just grit your teeth and do the partial submit. Hmm, speed vs. maintainability :-p

  • Adding items to a selectOneListbox from Javascript

    In my JSF page I have...
    <h:form id="alternateDeviceSelectForm">
        <h:selectOneListbox id="selectBox"/>
        <h:commandButton id="okButton" value="#{i18n.ok}" action="#{aBean.anActionMethod}"/>
    </h:form>I also have this Javascript...
    for (var i=0; i < devices.length; i++) {
        var device = devices;
    // a String
    var id = device.getId();
    // another String
    var displayName = device.getDisplayName();
    this.selectBox.options[i] = new Option(displayName,id);
    This creates the listbox and when the Javascript method fires, the appropriate items are listed in as list items.  However, when I hit the OK button, I get a JSF message about a validation error.  I'm not using any custom validation at all.
    Here's the error message I get... "alternateDeviceSelectForm:selectBox: Validation Error: Value is not valid"
    Any ideas on how I can get this working?  (I have to get the listbox item values from Javascript because that is the interface to a browser plugin that is involved in this process.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    dalearyous wrote:
    the only thing is there is no data to begin with. after you choose the data structure there is a text field to type in something like apple and then you click add. then you can type in something like pear and click add.If you do it right, the part that controls the data structures won't need to directly interact with the part that adds/removes the elements in the data structures -- they'll be independent units. That's what we call "orthogonal", and it helps make programs much easier to develop and maintain. To do that, you have a common set of add/remove operations across all data structures -- just like in the Collections framework, which you should use unless your teacher is telling you that you must make your own. (And even if you do, ask your teacher if you can use the interfaces from the Collections framework, if not the implementations.)
    The example I showed you supports that, in that it doesn't assume that the data structures initially contain any data. (Though it might be better to create empty Collections in your constructor, rather than ever letting existingCollection go null.

  • How to call a bean method from javascript event

    Hi,
    I could not find material on how to call a bean method from javascript, any help would be appreciated.
    Ralph

    Hi,
    Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
    Cheers,
    Ralph

  • Error while calling applet from Javascript via LiveConnect and WebDriver

    Hi all,
    I am trying to call applet Java code from Javascript via WebDriver.
    Given the following two cases:
    - calling a static method: Integer.parseInt("42")- constructing a new object: new String("Hello world")My Javascript code looks like this:
    document.appletId.Packages.java.lang.Integer.parseInt("42");
    new document.appletId.Packages.java.lang.String("Hello world");When executing this code in Firefox via the Firebug Javascript console everything works fine and I get the expected results. However, when executing this code via the JavascriptExecutor from WebDriver only the call to the static method succeeds, the construction of the new object leads to the following error: "Attempt to call a default method on object with no invokeDefault method."
    I don't have any idea what is going wrong here, so any help would be greatly appreciated.
    Thanks!

    Hello Gerard, Hello Krishna,
    -> The liveCache application failed with COM error::
                                   40028 Illegal timestamp in rough timegrid
    More details about COM error 40028 you will see in TA /n/sapapo/om10
         -> Return code: 40028 -> execute ::
    Invalid time stamp in the time buckets profile relation     
    ( om_ts_tgrelinvalidstamp )     
       < click on '?' mark >
    -> Open an OSS message in accordance with SAP note 167280 if further help
         needed to solve the issue on your system.
    Thank you and best regards, Natalia Khlopina

  • Calling1.4.1 signed applet from Javascript causes keyboard/focus problems

    Pretty sure there's a JRE bug here, but I'm posting to forums before I open one in case I'm missing something obvious :-)
    This issue may be specific to IE, I haven't tested elsewhere yet. Our web application is centered around a signed applet that is initialized with XML data via Javascript. We first noticed the problem when our users started upgrading from the 1.3.x plug-in to the 1.4.x plug-in. The major symptom was that shortcut keys stopped working. I debugged the problem off and on for about a month before I boiled it down to a very simple program that demonstrates the issue (included below). Basically, the program has a function that adds a JButton to a JPanel and registers a keyboard listener (using the new DefaultKeyboardFocusManager class) that prints a message to the console. This function is called by the applet's init() method, as well as by a public method that can be called from Javascript (called callMeFromJavascript()). I also included a very simple HTML file that provides a button that calls the callMeFromJavascript() method. You can test this out yourself: To recreate, compile the class below, JAR it up, sign the JAR, and put in the same dir with the HTML file. Load the HTML file in IE 5.0 or greater, and bring the console up in a window right next to it. Now click the button that says init--you should see the small box appear inside the button that indicates it has the focus. Now press some keys on your keyboard. You should see "KEY PRESSED!!!" appearing in the console. This is proper behavior. Now click the Init Applet from Javascript button. It has removed the button called init, and added one called "javascript". Press this button. Notice there is no focus occurring. Now press your keyboard. No keyboard events are registered.
    Where is gets interesting is that if you go back and make this an unsigned applet, and try it again, everything works fine. This bug only occurs if the applet is signed.
    Furthermore, if you try it in 1.3, signed or unsigned, it also works. So this is almost certainly a 1.4 bug.
    Anyone disagree? Better yet, anyone have a workaround? I've tried everything I could think of, including launching a thread from the init() method that sets up the components, and then just waits for the data to be set by Javascript. But it seems that ANY communication between the method called by Javascript and the code originating in init() corrupts something and we don't get keyboard events. This bug is killing my users who are very reliant on their shortcut keys for productivity, and we have a somewhat unique user interface that relies on Javascript for initialization. Any help or suggestions are appreciated.
    ================================================================
    Java Applet (Put it in a signed JAR called mainapplet.jar)
    ================================================================
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MainApplet extends JApplet implements KeyEventDispatcher
        JPanel test;
        public void init()
            System.out.println("init called");
            setUp("init");
        public void callMeFromJavascript()
            System.out.println("callMeFromJavascript called");
            setUp("javascript");
        private void setUp(String label)
            getContentPane().removeAll();
            test = new JPanel();
            getContentPane().add( test );
            JButton button = new JButton(label);
            test.add( button );
            test.updateUI();
            DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
        public boolean dispatchKeyEvent(KeyEvent e)
            System.out.println("== KEY PRESSED!!! ==");
            return false;
    }================================================================
    HTML
    ================================================================
    <form>
    <APPLET code="MainApplet" archive="mainapplet.jar" align="baseline" id="blah"
         width="200" height="400">
         No Java 2 SDK, Standard Edition v 1.4.1 support for APPLET!!
    </APPLET>
    <p>
    <input type="button" onClick="document.blah.callMeFromJavascript();" value="Init Applet via Javascript">
    </form>

    I tried adding the requestFocus() line you suggested... Same behavior.
    A good thought, but as I mention in my description, the applet has no trouble gaining the focus initially (when init() is called). From what I have seen, it is only when the call stack has been touched by Javascript that I see problems. This is strange though: Your post gave me the idea of popping the whole panel into a JFrame... I tried it, and the keyboard/focus problem went away! It seems to happen only when the component hierarchy is descended from the JApplet's content pane. So that adds yet another variable: JRE 1.4 + Signed + Javascript + components descended from JApplet content pane.
    And yes, signed or unsigned DOES seem to make a difference. Don't ask me to explain why, but I have run this little applet through quite a few single variable tests (change one variable and see what happens). The same JAR that can't receive keyboard events when signed, works just fine unsigned. Trust me, I'm just as baffled as you are.

  • What is the best way to call a pageflow action from JavaScript?

    What is the best way to call a pageflow action from JavaScript?
    Thanks,
    John

    John,
    How would I do this from a grid??? Unfortunately there are no JavaScript attributes
    on any of the grid tags that I can see.
    Thanks,
    John
    "John H" <[email protected]> wrote:
    >
    Thanks John!
    "John Rohrlich" <[email protected]> wrote:
    John,
    If you want to put up a confirm dialog before calling an action from
    an
    anchor it is done as follows.
    Here is an example from code of mine that deletes a customer order,if
    the
    user confirms the delete. I pass the order id as a parameter.
    - john
    Here is the JavaScript -
    function confirmDelete() {
    if(confirm('Continue with order delete?'))
    return true;
    else
    return false;
    Here is a sample anchor tag -
    <netui:anchor action="requestToDeleteOrder" onClick="return
    confirmDelete(); return false;">
    Delete
    <netui:parameter name="orderId" value="{container.item.orderId}"/>
    </netui:anchor>
    "John H" <[email protected]> wrote in message
    news:402138f5$[email protected]..
    Thanks for the replies. I figured it was going to require buildingmy own
    url
    to call the action. I had hoped there was an easier way to do it.Rich,
    the
    reason I want to do this is because I want to call the JavaScript
    function
    confirm()
    when a user clicks on a link (in a repeater/grid) to drop a record,I only
    want
    to call the drop action if the user confirms the drop. Maybe thereis a
    better
    way to do what I am trying to do??? I really appreciate any help
    you
    guys
    can
    give me on this, I am pretty new to this sort of stuff.
    Thanks,
    John
    "Rich Kucera" <[email protected]> wrote:
    "John H" <[email protected]> wrote:
    What is the best way to call a pageflow action from JavaScript?
    Thanks,
    JohnTry figuring out the URL to the pageflow action, create a hidden
    form
    in the
    page, then use JS to submit the form. Why would you want to though,
    isn't
    the server going to want to send you to the next page?

  • ANSWER: HOW TO DETECT Java Plugin from JavaScript

    I created a new topic because the questions about
    how to detect Java Plugin in browsers are scattered
    thoughout this forum.
    Basically you need to employ two approaches for IE and NS.
    In IE you need to try to instantiate a small applet
    (not your production applet) in order to see if browser
    can do it. if the browser can do it, you can make a
    call applet from JavaScript in order to find version of
    JRE (as well as a host of other things).
    In NS you can write a simple JavaScript which will
    interrogate the browser for all plugins installed. Then
    ypu can make a desicion whether to pass execution to
    the next(or generated) page which hosts your applet,
    or ask the user to download/install a plugin.
    I ecourage everybody to host a plugin on your site
    rather leave default link to it which is generated by
    html converter.
    In order to run sample,
    Prerequisites:
    Java Plugin 1.3.
    If you have a different version of plugin,
    substitute hardcoded plugin version in JavaScript for
    value that you have.
    1. compile java file
    2. put class file in the same directory with html file
    3. load html file into the browser.
    4. press "Check Java Plugin.." button
    5. see it work
    6. examine code
    7. uninstall plugin
    8. repeat steps 1 - 4
    9. see it work
    10. install plugin.
    Sample code follows:
    **********************HTML FILE BEGIN***********
    <HTML>
    <HEAD>
    <!-- Generated by Kawa IDE -->
    <TITLE>Detect Java Runtime</TITLE>
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    var browsername;
    function doNetscape()
    for (i=0; i < navigator.plugins.length; i++)
    for (j = 0; j < navigator.plugins.length; j++)
    if(navigator.plugins[i][j].type == "application/x-java-applet;version=1.3")
    alert("You are running Netscape with Java Plugin 1.3.0 - OK");
    return;
    alert("You are running Netscape\nPlease, install Java Runtime Environment 1.3.0");
    function doMicrosoft()
    var applet = document.myApplet;
    if(applet == null)
    alert("You are running Microsoft Browser.\nPlease, install Java Runtime Environment 1.3.0");
    return;
    var version = applet.getJavaVersion();
    if(version == "1.3.0")
    alert("You are running IE, Java Plugin 1.3.0 installed - OK");
    else
    alert("You are running IE, other plugin installed - mybe OK if later that 1.3.0\nYour version: " + version);
    function getJava()
    var applet = document.myApplet;
    if(applet == null)
    alert("Please, install Java Runtime Environment");
    return;
         alert("JRE Version: " + document.myApplet.getJavaVersion());
    function checkJavaPlugin()
         browsername = navigator.appName;
         if(browsername.indexOf("Netscape")!= -1)
              browsername="NS";
              doNetscape();
         else
              if(browsername.indexOf("Microsoft")!=-1)
                   browsername="MSIE";
                   doMicrosoft();
              else
                   browsername="N/A";
                   alert("Unknown browser: " + browsername);
    </SCRIPT>
    <body>
    <Strong>Check Java Plugin</strong>
    <OBJECT id="myApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
         WIDTH = 1
         HEIGHT = 1 >
         <PARAM NAME = CODE VALUE = "DetectPluginApplet.class" >
         <PARAM NAME="scriptable" VALUE="true" >
         <embed type="application/x-java-applet;version=1.3"
              code = DetectPluginApplet width = 2 height = 2 MAYSCRIPT = "true" >
         </embed>
         </EMBED>
    </object>
    <FORM>
         <INPUT TYPE="button" value="Get Plugin Version in IE" onClick="getJava()">
         <INPUT TYPE="button" value="Check Java Plugin in NS and IE" onClick="javascript:checkJavaPlugin()">
    </FORM>
    </BODY>
    </HTML>
    **********************HTML FILE END***********
    ***************APPLET FILE BEGIN***********
    import java.awt.*;
    public class DetectPluginApplet extends java.applet.Applet
         public void init()
              add(new Label("DetectPluginApplet"));
    public String getJavaVersion()
    return System.getProperty("java.version");
    **************APPLLET FILE END************

    Try following java script, it works on new browsers (NS 4+, IE5+). For IE you have to enable 'ActiveX objects creation' in security options.
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
    && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
    && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0") !=-1));
    var is_ie5up = (is_ie && (is_major == 4)
    && ( (agt.indexOf("msie 5.0")!=-1)
    || (agt.indexOf("msie 5.5")!=-1)
    || (agt.indexOf("msie 6.0")!=-1) ) );
    var pluginDetected = false;
    var activeXDisabled = false;
    // we can check for plugin existence only when browser is 'is_ie5up' or 'is_nav4up'
    if(is_nav4up) {
    // Refresh 'navigator.plugins' to get newly installed plugins.
    // Use 'navigator.plugins.refresh(false)' to refresh plugins
    // without refreshing open documents (browser windows)
    if(navigator.plugins) {
    navigator.plugins.refresh(false);
    // check for Java plugin in installed plugins
    if(navigator.mimeTypes) {
    for (i=0; i < navigator.mimeTypes.length; i++) {
    if( (navigator.mimeTypes[ i].type != null)
    && (navigator.mimeTypes[ i].type.indexOf(
    "application/x-java-applet;jpi-version=1.3") != -1) ) {
    pluginDetected = true;
    break;
    } else if (is_ie5up) {
    var javaVersion;
    var shell;
    try {
    // Create WSH(WindowsScriptHost) shell, available on Windows only
    shell = new ActiveXObject("WScript.Shell");
    if (shell != null) {
    // Read JRE version from Window Registry
    try {
    javaVersion = shell.regRead("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment\\CurrentVersion");
    } catch(e) {
    // handle exceptions raised by 'shell.regRead(...)' here
    // so that the outer try-catch block would receive only
    // exceptions raised by 'shell = new ActiveXObject(...)'
    } catch(e) {
    // Creating ActiveX controls thru script is disabled
    // in InternetExplorer security options
    // To enable it:
    // a. Go to the 'Tools --> Internet Options' menu
    // b. Select the 'Security' tab
    // c. Select zone (Internet/Intranet)
    // d. Click the 'Custom Level..' button which will display the
    // 'Security Settings' window.
    // e. Enable the option 'Initialize and script ActiveX controls
    // not marked as safe'
    activeXDisabled = true;
    // Check whether we got required (1.3+) Java Plugin
    if ( (javaVersion != null) && (javaVersion.indexOf("1.3") != -1) ) {
    pluginDetected = true;
    if (pluginDetected) {
    // show applet page
    } else if (confirm("Java Plugin 1.3+ not found, Do you want to download it?")) {
    // show install page
    } else {
    // show error page
    }

  • How to call jpf controller method from javascript

    Can any one help me how to call pageflow controller method from JavaScript.\
    Thanks.

    Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
    1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
    document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
    document.getElementById("batchForm").submit;
    2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
    document.getElementById("ACTION_NAME").value = "UPDATE";
    document.getElementById("batchForm").submit.
    Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
    3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
    This entire lines of code should do what we want.
    <netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>                    
    <netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
    <c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
    <%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
    <netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
    </c:forEach>               
    </netui:select>
    See if you can build along those above lines of code. Any other simpler approches are highly welcome.
    Thanks
    Ravi Jegga

  • Is it possible to access an object inside a Captivate movie from Javascript?

    For example, my JavaScript performs some processing, based on which a particular button inside the movie needs to be hidden. Can I access a particular button from JavaScript to be able to do this? If not, then is it possible to be notified inside the Captivate movie, when a variable has been set by JavaScript?  I notice that the JavaScript interface in Captivate 8 provides an event (CPAPI_VARIABLEVALUECHANGED) which fires when the value of a variable inside the Captivate movie changes. If there was a similar event which would fire inside the Captivate movie, when a variable changes then I could have set a variable using JavaScript and hidden a particular button using an advanced action, when the event for that variable changing fires inside the Captivate movie.
    Articulate Storyline has an event which gets triggered when the value of a variable changes (either because of JavaScript executing or otherwise). If something similar was possible in Captivate, it would open up many possibilities.
    I am evaluating Captivate 8.
    Thanks in advance for any help.

    hi
    Yes. its possible but its not recom
    you can set in production system to allow changes to obj rsa1->transport connection->click 'object changeability', and look for object type , and set to changeable.
    pls refer these below posts
    transport a query backwards, from production to development
    Re: Transporting Process Chains from Production DOWN to QA and Dev
    assign points if useful.....
    Shreya

  • How to execute FM from Javascript function?

    Hi All,
    I have a requirement to execute ABAP FM from Javascript function in BSP Application.
    How do I implement this?
    Is there any document/link in SDN?
    Thanks
    Thruna Shanmuga

    Hi,
    When button is clicked capture the event in OnInPutProcessing and call the function module.
    In layout mention the java code
    Here is a sample code:
    Layout Code:
    < script >
    document.on keydown=function( )
    if (event.key Code==13)
    htmlb SL(this,2,'get') Mention the button ID
    < /script >
      <htmlb:button id      = "get"
                             text    = "Execute"
                            width   = "35%"
                            on Click = "On InputProcessing()" />
    OnInPutProcessing Code:
    data:
      w_event type ref to cl_htmlb_event,
    call method cl_htmlb_manager=>get_event
      exporting
        request = runtime->server->request
      receiving
        event   = w_event.
    case w_event->id.(To capture the event)
    when 'get'.
    <<Call the function module>>
    endcase.
    Hope this solves the issue, Let me know if any queries.
    Regards,
    Rajani

  • Calling from javascript a method which uses accesscontroller.dopriviledged

    Hello everybody!
    I've a problem in accessing my pc resources from a signed applet when calling methods from Javascript.
    If I try from start() or init() methods, I can do it, but as soon as I try from anoter method defined by myself, it throws this me an AccessControlException:access denied.
    I googled and found that I should use this code:
    KeyStore smartCardKeyStore= (KeyStore)
                 AccessController.doPrivileged(
                           new PrivilegedExceptionAction() {
                             public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
                                 KeyStore alfa;
                                 alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
                                 alfa.load(null,null);//this is the point where it trhew the AccessControlException
                                 return alfa;
                         );The problem is that with this code, I can't get it work with Firefox (which doesn't throw any exception, just won't work!) neither with IE, which throws this:
    netscape.javascript.JSException: Nome sconosciuto.
    java.lang.Exception: netscape.javascript.JSException: Nome sconosciuto.
         at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
         at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin.com.DispatchImpl.invoke(Unknown Source)Please, help me! I'm in a big trouble, since I should finish my project asap and I am not able to pass this cumbersome obstacle...
    Thank you in advance! :)

    Hi! Don,
    You cannot call methods which breach Security from Javascript. That is what SUN says.
    But there is a hack, or a work around...
    Declare a boolean Variable , say named buttonClicked.
    Initailly keep its value false(default).
    Write an inner class that extends a thread class whose RUN method will contain the following piece of Code:
    public void run(){
        while(buttonClicked){
                     KeyStore smartCardKeyStore= (KeyStore)
                 AccessController.doPrivileged(
                           new PrivilegedExceptionAction() {
                             public Object run() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException {
                                 KeyStore alfa;
                                 alfa = KeyStore.getInstance("PKCS11",pkcs11Provider.getName());
                                 alfa.load(null,null);//this is the point where it trhew the AccessControlException
                                 return alfa;
    }You start the Thread inner class in your init method.
    So, its RUN method will continuously be waiting to go into the while loop.
    And in your start method you will set the +"buttonClicked"+ variable to true upon a Javascript onclick event of a button.
    So, the moment you click a button, you only set the buttonClciked variable to true in your start method--------
    This does, in no way breach security. So no exception is thrown.. But the code which breaches security is initiated by another thread other than that spawned the Applet; so the browser does not care anything about its privileges. It just lets the execution of the code.
    I hope it works for you; be in contact, if it doesn't.
    Thanks and Regards,
    Samba

  • Access selectItems component from javaScript

    Hi,
    In the source below I want to access a selectItems component inside of a selectOneRadio from javaScript. I can access the selectOneRadion as in the code below but I can not the selectItems. Anyone who has an idea?
    <afh:script text='
    function showValue() {
    var test=document.getElementById ("form1:radio1").value;
    alert(test);
    />
    <af:selectOneRadio label="Label 1" id="radio1" >
    <f:selectItems value="1" id="radio2" />
    </af:selectOneRadio>
    thanks in advance

    Hi,
    for a select item the code is
    2nd value of a list
    ================================================
    <input type="button" name="click" onClick="alert(document.form1.select.options[1].value)">
    2nd label in a list
    ====================================================
    <input type="button" name="click" onClick="alert(document.form1.select.options[1].text)">
    selected value
    ==========================================
    onClick="alert(document.form1.select.value)"
    where
    <form name="form1" method="post" action="">
      <select name="select" size="1">
        <option value="1" selected>A</option>
        <option value="2">B</option>
        <option value="3">C</option>
      </select>
      <input type="button" name="click" onClick="alert(document.form1.select.value)">
    </form>
    Frank

  • Invoking client listener from javascript

    Hello,
    I am using ADF Faces 11g.
    I wonder if it is possible to invoke a UI control's client listener from javascript method. For example i have a command link with a client listener, defined like this:
    <af:commandLink id="cl1" text="click here" partialSubmit="true">
    <af:clientListener method="onClickLink" type="action"/>
    </af:commandLink>
    I can find the control in a javascript method, with this: AdfPage.PAGE.findComponent("cl1");
    Now i want to invoke the onClickLink(event) method. How can i do it?
    Thanks.

    Isn't this just calling onClickLink(event)?
    Or do you want to know how to get the function the client listener calls?
    May be you should take a look at http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/classic_api_mistakes_part2/classic_api_mistakes_part2.html
    At about min 35 of he video Frank shows something like what you like to do (as fas as I recall).
    Timo

  • How to access the controller method from javascript onclick event?

    Hi All,
       I am totally new to development. And I got struck in calling a controller method from javascript function.
       I have no idea about ajax and all those things. Please can anyone help me to solve this issue!
    Thanks in advance.

    Hi,
    As I know, you can use jQuery to do this, here is an example.
    Example of your Controller Method.
    [HttpPost] // can be HttpGet
    public ActionResult Test(string id)
    bool isValid = yourcheckmethod(); //.. check
    var obj = new {
    valid = isValid
    return Json(obj);
    and this would be your javascript function.
    function checkValidId(checkId)
    $.ajax({
    url: 'controllerName/Test',
    type: 'POST',
    contentType: 'application/json;',
    data: JSON.stringify({ id: checkId }),
    success: function (valid)
    if(valid) { //show that id is valid }
    else { //show that id is not valid }
    If you have further issues, I would suggest you move to MVC forum, it is appropriate and more experts will assist you.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • How do I keep the Spry menu fixed to the bottom of the header div?

    I have created a horizontal Spry menu bar using Dreamweaver CS4 but the problem is, I can't figure out how to make it be in the right position at the bottom of the header div. In Design View it is too far below the header background graphic, in Live

  • Exception is thrown when creating bean

              Hi, I have some questions about transaction.           In my case, i call a stateful session bean through the stateless session bean.           When the bean is created, following exception is thrown           "javax.transaction.Transaction

  • Aggregates question

    Say i have 4 million records in a cube. Say by each value type, the records are as follows: 1 million actual 1 mill plan and 2 mil not assigned I have a query with 2 selections. selection 1 is filtered on actual. Selection 2 on plan. Now if I hv 2 ag

  • Importing a DLL created with Cygwin

    I am trying to import a DLL created with Cygwin. This is a test DLL created by one of my collegue to validate the import process. When I use the import Wizzard, everything run ok. It recognise and build the structure based on the header file. When I

  • What are the little filling circles when you click on a mailbox

    in regards to .mac via mail application, what is the the circle that fills up like a pie being cut backwards when you click a mailbox??