Button executing CloseWindow Java Script and raising event on server

Hi All.
Somebody can help me with this:
<b>What i'm needing:</b> an 'END' button on a BSP, when the user click on this button just show an aswer box asking if the user wants to close the windows, in case to click yes close the current window and execute a business logic in the controller.
<b>What i have:</b> a button with the event onClientClick invoking a Java Script function which is showing the answer box and the event onClick which raise the event on the server side. The thing is if the user click on yes then i'm closing the current window and the server event never is triggered. This is not working !!!
Any ideas ? some sample code ?
Thanks in advance.
Armando.

Hi Armando,
The 'Yes' on the <i>Confirm dialog box</i> (Client Side Scripting) has to tell the application (Server side scripting) to call your METHOD XXX. This is done by passing querystring <i>exit=X</i> to the URL.
1. Comment onClick event of the button.
2. Modify the code the JS function of your End button as follows
   func_end()
//if no
  // your original code
// if yes
document.location.href = document.location.href + '?exit=X';
3. Add following code to DO_REQUEST
  IF REQUEST->GET_FORM_FIELD( NAME = 'exit' )  ne space.
*your method will be called only when there is an exit=x in the url
       call method XXX.
*set a page attrib as follows
       l_exit = 'X'.
  ENDIF.
4. Add following code to your layout
<%if l_exit = 'X'.%>
<script>
window.close();
</script>
<%endif.%>      
Regards,
Alwyn

Similar Messages

  • Can a Button call a java script and then proceed with the creation

    Hi all,
    I have a simple APEX form on a table,
    with simple function as create and apply changes,
    some items of the form are computed by a "Computation"
    I need the create button to show the computed values, before move to the next page, then proceed with the creation ( submission)
    I have tried to show the values by a java script, but after clicking the button OK of the javascript msg, no submission performed ,
    details:
    the java script is called in the URL of the Button,
    it only contains a alert statement
    is there a way to let the button do that
    or may be the case could be solved by another idea!!!
    rgrds,

    Hi Varad,
    It is Before header of course. I forgot to mention this.
    Yes, you are right Varad, I have read again the question and seems original request was to show Computation that is done in After Submit, more javascript is required of course.
    One possibility is to create On Demand process called COMPUTEITEM where you compute your item, and in the end of on demand process it prints it
    htp.p(:P1_X)
    Then put in HTML header of your page
    <script language="JavaScript" type="text/javascript">
    function setShowItemSub(pThis){
       var l_This   = $x(pThis);
       var ajaxRequest = new htmldb_Get(null, $v('pFlowId'),  'APPLICATION_PROCESS=COMPUTEITEM', $v('pFlowStepId'));
       ajaxRequest.add($x(l_This).id, $v(l_This));
       var gReturn = ajaxRequest.get();
       alert(gReturn);
       ajaxRequest = null;
      doSubmit('aa');
    </script>And in Button URL textarea put:
    javascript:setShowItemSub('P1_X');
    Then no need in After Submit process anymore
    I have put this now in http://apex6.revion.com/pls/apex/f?p=225:1
    COMPUTEITEM On demand process is :
    :P1_X := :P1_X || ' Added this trail';
    htp.p(:P1_X);Of course, all this should be modified accordingly
    Regards,
    Oleg

  • Get system variable and execute a Java Script

    I'm not sure it is the appropriate forum to ask this
    question. I'm using Captivate 2 without LMS.
    I need to execute a java script that take read a system
    variable (eg. USERNAME) and opens an URL using the USERNAMe as
    parameter. The idea here is to update a database opening a specific
    URL for a specific USERNAME.
    Any one has an example to do something similar ?

    Hello All,
    Could anyone please help me with some examples or
    tutorials how I can create Java Applet to run telnet
    to UNIX and execute a shell script?
    Presumably you don't need to write the telnet code yourself (like for a class.)
    If so then you can use this...
    http://jakarta.apache.org/commons/net/
    There might be some other dependencies from other commons stuff that you will need to resolve to run it.
    Once you have that, presumably you are not telnetting back to the source of the applet. If so you will need to deal with security for the applet. Usually that means that you must sign the applet. Otherwise you will have to modify the policy file on each client machine that will run the applet.

  • Executing Essbase Clear Script through FDM event scripts

    Hi,
    Is it possible to access and execute essbase clear script through FDM event scripts? I know one method is to modify Load action, but was wondering if can be done any other way.
    Thanks in advance.

    The Essbase client is installed on the FDM application server so yes. You can create a batch file that calls a calc script via the Essbase Client and execute this from your Event script

  • What're the differences between JSP, Java Script, and Java Applet?

    I am confused by the concepts: JSP (Java Server Page), Java Script, and Java Applet? What are their main differences?

    I don't know about differences, but one of their main similarities is that each of them has a page in Wikipedia.
    JSP
    JavaScript
    [Java applet|http://en.wikipedia.org/wiki/Java_applet]
    There. That should give you enough information.

  • Problem  in merging java script and java code

    hi,
    i want to merge java and javascript code but it is giving some surprising results.
    this is my code:
    <script language = "javascript">
    <%
    String query_result= "1";
    String buttontype="";
    buttontype=(String)session.getAttribute("buttontype");
    query_result = (String) session.getAttribute("query_result");
    out.println(query_result);
    if(buttontype!=null&&(buttontype.equals("submit")))
    out.println(buttontype);
    %>
    alert(<%=ka%>)
    </script>
    <%
    %>
    now if i'll move "<script language = "javascript">" to:
    <%
    String query_result= "1";
    String buttontype="";
    buttontype=(String)session.getAttribute("buttontype");
    query_result = (String) session.getAttribute("query_result");
    out.println(query_result);*/
    if(buttontype!=null&&(buttontype.equals("submit")))
    out.println(buttontype);
    %>
    <script language = "javascript">
    alert(<%=query_result%>)
    </script>
    <%
    %>
    then it prints correctly and gives alert "1" but if i'll change query_result="manish" then it is not giving alert also
    i don't know wht is happening
    plz help me out
    manish

    hi pgeuen,
    Thanx for ur reply
    now its working i have changed my jsp exp. tag to
    alert("\"<%=ka%>\"")
    and it is displaying correctly.
    and if i'll give the scripting tags in "if block"then it will work but till now i didn't get why i was not getting any output when the scripting tags covers the whole jsp code. i think we can mix java script and jsp in any way.
    well thanx a lot.
    manish

  • What is java script and how do I enable it?

    What is java script and how do I enable it

    JavaScript is enabled by default for Adobe Reader for iOS, and I don't see that there's a way to disable it. It is currently used within a document to control the behavior of form fields, such as automatic formatting and calculations. Only a small subset of what's available in the desktop version is available in the mobile versions.

  • How to detect whether browser's java script  disabled or not from server

    How to detect whether browser's java script disabled or not from server side

    I would use a hidden parameter created by a javascript. if this is null, javascript is disabled...

  • Needed help on java script and html in PL/SQL doing nothing

    Hi,
    Created a procedure which takes username and password and changes OID, database password for that user with that password.
    I created a page in oracle portal and trying to call this below script package:
    BEGIN
    user_name := portal.wwctx_api.get_user;
    HTP.p
         <!-- BEGIN CODE FRAGMENT -->
         <script language="javascript">
         <!--
         function ValidatePass()
         var passStr = document.getElementByid("p_password").value;
         var confPassStr = document.getElementByid("Confirm_Password").value;
              var pattern = /[^a-zA-Z0-9]/;
              if (passStr == null || passStr == "") {
                   alert("Password value missing");
                   return;
              if (confPassStr == null || confPassStr == "") {
                   alert("Confirm password value missing");
                   return;
              if (passStr.match(pattern) == null && confPassStr.match(pattern) == null) {
                   if (passStr == confPassStr) {
                        document.form.submit();
                   } else {
                        alert("Your entries did not match. Please try again!");
              } else {
                   alert("Invalid charcters entered");
         //-->
         </script>
         <form name="changepassword"
         action="http://<hostname>:7777/pls/sys/sys.gx_user_mgt.globally_update_password"
              method="post" AutoComplete="Off">
    <input type="hidden" name="username" value=" '
    || user_name
    || ' " id="p_username"/>
    New Password:
    <input type="password" name="p_password" id="p_password">
    <br>
    <br>
    Confirm Password:
    <input type="password" name="Confirm_Password" id="Confirm_Password">
    <br>
    <br>
    <input style="padding:2px;" type="submit" value=Login onClick="ValidatePass();">
    </form>
    END;
    This gx_user_mgt.globally_update_password is the custom procedure I should call passing username and p_password
    Thanks in advance.

    Friends I want to try something but I am totally lost on how to achieve it.Just to let u know that I have not worked in JAVASCRPT at all.And I am in great hurry to finish this work.
    What I am looking for is :
    1) a JSP page is thrown
    2) a button is clicked
    3)Moment the button is clicked I want a file to be created with an extension HTML (having all the info from the database) by using FileWriter class .After the file is created and ready ,Then I want to open this file in another browser window.
    I know that to achieve this I have to use Javascript,but I am totally lost on how to do that.
    I mean can I say in JAVASCRIPT that if this button is clicked then execute a java method which retrives data from the oracle database in the server and writes it to a HTML file and then after the writing is done,open it another window.
    Please help.

  • Urgent !!! - Java script help for events in adobe form

    Hi ,
    We have requirement  where we have 5 buttons on interactive form which will retrive data from R/3 system .
    1) How can i distingish the event of each button  ?
    For Ex : We have 5 buttons namely , GetPlantcode , GetStatus, SubmittpSAP etc..
    We hav only 2 events on adobe form - Submit to SAP and SAPCheckFields.
    Please let me know some alternative by which i can sent some variable to webDynpro which distinguishes them.
    2) How to set a value for the context variable on button click event ?
    Ex : I have a context node ( data node ) bind to adobe interactive adobe component on a webDynpro application. If i want to set Selectindicator ( value attribute in data Node ) a value on a button click , Please let me know the java script how i can do this.
    Happy New Year for all
    Nanda

    Hi ,
    We found one work around for this. It seems to solve our issue for now.
    Set a text field on adobe and try to set it with some value in each button click. We can get retrived that value in webdypro application through context bind value node to text field.
    Using the value in the value node we have applied different logic in same event submit to SAP.
    Nanda

  • Java Script and HTML

    Hi,
    i am creating a web page dynamically through ajax like this
    here i am creating a td element and appending a button element to it
    var td5= document.createElement("TD");
         td5.style.whiteSpace = "nowrap";
         td5.setAttribute("id", "button" + hostname);
         var button=document.createElement("input");
        button.setAttribute("type", "button");
        button.setAttribute("id", "updatebutton" + hostname);
        button.setAttribute("value", "Click here");
        button.setAttribute("onclick", "alert('OK')");
        td5.appendChild(button);it appearing good on web page the but when i click the button, where i am not getting supposed alert
       button.setAttribute("onclick", "alert('OK')"); line is not showing effect
    when i try like this
    button.onclick=new Function (alert('hi'));when my IE loads the page i am getting alert where as , alert must come after clicking the button
    any work around please
    Thanks
    R

    Friends I want to try something but I am totally lost on how to achieve it.Just to let u know that I have not worked in JAVASCRPT at all.And I am in great hurry to finish this work.
    What I am looking for is :
    1) a JSP page is thrown
    2) a button is clicked
    3)Moment the button is clicked I want a file to be created with an extension HTML (having all the info from the database) by using FileWriter class .After the file is created and ready ,Then I want to open this file in another browser window.
    I know that to achieve this I have to use Javascript,but I am totally lost on how to do that.
    I mean can I say in JAVASCRIPT that if this button is clicked then execute a java method which retrives data from the oracle database in the server and writes it to a HTML file and then after the writing is done,open it another window.
    Please help.

  • Java script and scriplets

    Hi,
    I have got a .jsp page wherein there is a 2 dimentional string array defined within a scriplet.
    I have defined an other function in java script within the same page.
    Now I need to access the string array within the java script. Can someone please hep me how to achive this...
    I tried something like this, but its not working:
    function displayNameIndex()
    var source = <%= imgArrayName %>[0][0];
    where imgArrayName is the name of the String array in the scriplet code.
    Many thanks

    JSP is executed at the serverside and generates a long HTML string. Javascript is part of this HTML string. Once this string is arrived at the client, the JS will/can be executed.
    What you're expecting here is that the Javascript is able to access the Java Object which is converted into a simple plain vanilla string. That is not true. Better is to put all of this logic in the server side or in the client side. You may need to iterate through the Java String[][] object and print all values into the response, so that JS can access them.

  • Java script and the new and not improved firefox don't work. Please let me be able to run Java again.

    I use SAP Infoview for work. To modify reports it requires a Java script to run. I had it set up in the previous version of ff to always allow from this specific site and it worked wonderfully. Now, in the new version, despite following all of the instructions from others, I cannot do my work because I cannot run Java script. I can still run it in Safari, but Safari is a last resort for me to use. I prefer Firefox and have all of my links stored there.

    Some sites are not fully compatible with Firefox 4's new HTML5 rendering engine. Can you turn that off and test without it? Here are the steps:
    (1) Open a new tab, then type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the filter box, type or paste '''html5''' and pause while the list is filtered
    (3) Double-click '''html5.parser.enable''' to toggle it to false (it should turn bold).
    Then change back to the SAP tab and reload the page.
    Does that make any difference?

  • Problem in calling Java Script and Process at the same time

    Hi Frenz,
    I have a requirement like this. when i press the button a page level process(Not Application level Process) and java script function has to happen. i wrote the Java script function to close the child window and reload the Parent window. I wrote the Process for the Parent window to get the updated screen.
    But the Process is not happening and the only the java script function is achieved.
    Can you suggest any idea to achieve both of the things at the same time?
    Thanks in Advance.....

    See this example:
    http://apex.oracle.com/pls/otn/f?p=31517:93
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Jsp,java script and html

    Friends I want to try something but I am totally lost on how to achieve it.Just to let u know that I have not worked in JAVASCRPT at all.And I am in great hurry to finish this work.
    What I am looking for is after
    1) a JSP page is thrown
    2) a button is clicked
    3)Moment the button is clicked I want a HTML file to be created (having all the info from the database) by using FileWriter class .After the HTML file is created and ready ,Then I want to open this HTML file in another window.
    I know that to achieve this I have to use Javascript,but I am totally lost on how to do that.
    I mean can I say in JAVASCRIPT that if this button is clicked then execute a java method which retrives data from the oracle database in the server and writes it to a HTML file and then after the writing is done,open it another window.
    Please help.

    Friends I want to try something but I am totally lost on how to achieve it.Just to let u know that I have not worked in JAVASCRPT at all.And I am in great hurry to finish this work.
    What I am looking for is :
    1) a JSP page is thrown
    2) a button is clicked
    3)Moment the button is clicked I want a file to be created with an extension HTML (having all the info from the database) by using FileWriter class .After the file is created and ready ,Then I want to open this file in another browser window.
    I know that to achieve this I have to use Javascript,but I am totally lost on how to do that.
    I mean can I say in JAVASCRIPT that if this button is clicked then execute a java method which retrives data from the oracle database in the server and writes it to a HTML file and then after the writing is done,open it another window.
    Please help.

Maybe you are looking for

  • Unable to start scenario

    Is this the correct version of JDK I should be using? Please look below: Thanks, Dinesh. I set my ODI_JAVA_HOME to C:\Program Files\Java\jdk1.6.0_14. However I am getting the below error: F:\OraHome_1\oracledi\bin>startscen TEST 001 GLOBAL LEVEL5 Ora

  • Output list of attendees

    I need to be able to output a list of attendees for events from the events module in 3 different ways. Permission 1. individual customers can see which events they are subscribed to, permission 2. should be able to see who else is attending from thei

  • How do you backup IPhone contact list to Computer (XP) PC Computer?

    How do you backup IPhone Contact List to PC Computer(XP) ?

  • Fixing Recovery Partition

    I have hp dv6-3037tx I recently installed a new motherboard in my computer. Ever since, I have not been able to boot into the recovery partition. E.g. I press F11 at startup and nothing happens, it just boots directly to the Windows 7 Home Premium  O

  • Trojan Virus from Song Lyrics?

    So I went to look up song lyrics and an ad popped up.  I clicked the "X" in the corner and suddenly it opened up a new tab with a Safari window telling me that my "PC" had caught a trojan virus that could access my log-in information (I'm using a Mac