Submit processing with javascript "onUnload" event

Hi there,
I want a page to save its state regardless of how the user exits the page. Using page tabs, which have direct URLs, it seems the only way to do this is to use a javascript "onUnload" event which calls doSubmit(). The problem with this is that the submission requires a branch. Obviously, I don't want to branch the page; a destination has already been set. Telling the branch the is impossible as there is no way to access the destination URL for an onUnload event (understandably; it would be a serious breach of privacy.)
So, the question I have is: is there any way to get a call to doSubmit() (or similar) to process the page, but not branch afterwards?
Many thanks,
Robert

Robert,
Take a look at the following thread -
Re: clean page items when user leaves a page
Whilst that thread deals with clearing items when the user leaves a page, it illustrates the issues of trying to capture the event of the user 'leaving' the page (after all 'leaving the page' could mean that they navigate to Google instead).
An alternative way would not to try and capture the 'leaving event' but to store the values in session state automatically (perhaps using some of Carl's Ajax examples) when the user types them in, then have an application process that runs on every page that determines whether those values need to be written to the database or not.
As an aside...I've heard of this requirement coming up quite a few times and I always question the logic behind it....since for every method that you can come up with as a way of forcing my input to be saved, I can come up with a way that will prevent it from working....until eventually we just reach the stage where I stand up and switch the machine off ;)

Similar Messages

  • After submit process vs. javascript

    I'd appreciate it if you all could help me with this problem. I've searched this forum and google for a resolution but have not found it yet. I'm a newbie with APEX so please bear with me. The issue is that I want a button - could be a delete or submit - to be disabled after it is clicked. Additionally I want a process (on submit after computations and validations) to execute when the button is clicked. The dilemma is that the javascript disable button function is called using a URL button (create a button in a region position). My guess is that the on submit process is not fired because the focus goes to the URL (disable button function). Is there any way to call a javascript from non-URL button (Create a button displayed among this region's items)? Or perhaps get the process to run with a URL button? So my issue is I need both the after submit process to run and the javascript to disable the button to run after the button is clicked. Suggestions appreciated.
    Kirk

    Like I indicated I'm a newbie to this web programming. And at this point I'm just learning APEX for possibilities here and because management wants a presentation on it at one of our upcoming meetings.
    After the branch to the URL - which my understanding would be to the same page - it would come up without a record until the user selects one from some mechanism like an LOV. And with no record displaying I'd want the Delete (and Update) button disabled until a record is selected. And now that I'm writing this it has me thinking I need to approach this from a different angle. I need the page to come up with the Delete and Update button already disabled and when a record is selected then (somehow) the buttons should be enabled. Do you think this a more viable approach?

  • XML Processing with JavaScript for Safari

    Hi
    I've created an application which binds request and response data in XML format. I've written code in JavaScript for parsing the response data and build request based on the response XML. Here, I use functions like appendChild, cloneNode and all. My application runs without any problem on Mozilla FireFox and InternetExplorer. But I don't get it run in Safari 2.0. I get error in appendChild method in most cases. Please help me out in resolving this issue. Thanks in advance.
    Mac   Mac OS X (10.4)  

    Hi and Welcome to Apple Discussions
    This forum addresses issues usually focused on Safari's operation, features and related internet issues from a user perspective. As a web developer you may find an answer to your question at the WebKit Open Source site.
    Good Luck

  • Associating a process with a 'select list with submit'

    Hi,
    In a tabular form I have 2 'select list with submit'. If a row is selected in the tabular form I need the following functionality from each of the select lists:
    Once a value is selected from the list a process will get excuted which will update a column of the checked row in the database table with the selected value from the list.
    My question is,
    1. How can I associate an 'after submit process' with the 'select list with submit'?
    2. Can I store the selected value in a variable which I can pass as an input parameter to a PL/SQL body?
    Regards,
    AM

    Hi,
    Please see my requirement below.
    I have a 'select list with submit' say P1_Select in a Tabular form Page. I want to create an after submit process (PL/SQL Process) which will take the selected value from the select list as input parameter and perform an update function for the checked row with that value.
    I'm trying give a feel the procedure:
    CREATE OR REPLACE procedure "P_REJECT"
    (p_message IN VARCHAR2 default Null)
    is
    begin
    FOR ii IN 1 .. APEX_APPLICATION.G_F01.count
    LOOP
    UPDATE NI SET NI.STATUS_NI = 'WCONF', NI.NI_Message = p_MESSAGE
    WHERE NI.NI_REF = APEX_APPLICATION.G_F01(APEX_APPLICATION.G_F01(ii));
    END LOOP;
    end;
    As suggested by Flavio I created the conditional 'after submit' process where I'm making a call to the above procedure.
    1. I am not sure how to pass the selected value as a parameter to the proc.
    2. 'request = value, where the value is the string literal P1_SELECT'.... Could not really figure out the meaning of string literal P1_SELECT
    Regards,
    AM

  • Running process from javascript

    Hi all,
    I'm trying to run a page process with javascript with the htmldb_Get but I have no results until now. My example is very simple, it's just click on a page link and call a javascript function like this:
    <script type="text/javascript">
    function test(){
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=myProcess',0);
    gReturn = get.get();
    get = null;
    </script>
    Can someone help, I don't understand what I'm doing wrong.
    Tks in advance

    Hi,
    On Demand is type of application process.
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/bldr_pgs.htm#sthref847
    Probably all examples what you have seen about htmldb_Get are calling On Demand process.
    Regards,
    Jari
    Edited by: jarola on Mar 15, 2011 1:14 PM
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/bldr_pgs.htm#sthref840

  • Associating two events with submit button using  javascript in jsp

    Hi
    How can i Associate two events with submit button using javascript in jsp. Firstly it should insert the data to database and secondly it should close the same pop-up window

    Have something like :
    <input type="submit" name="submitbtn" value="Click me" onClick="function1(); function2(); " />
    You just call both functions sequentially, it's that simple. Although using javascript to work with a database, that seems a bit tricky.

  • Call javascript function after submit process

    Hi,
    How can I call javascript function after my submit process ?
    Thanks.

    Hi Carl,
    You say that I must have an Item or region that contains my js with conditionnal display. With this method I can execute my js with specific request value.
    My problem is that I tried to integrate the "save large value workaround" in my application with the APEX wysiwyg (fckeditor). To do that I have to call the javascript function clob_submit on the save button. This function save the value of my field but if I want to save other item value, how can I do that ?
    If I use your method, I will submit the page, save the other field and after that, I will branch on the same page. At this moment, I will execute my javascript file.
    Is it what did you said ?
    Sylvain Michaud
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

  • Subscribe event and processing with data

    Hi.
    We made a portal component with DynPageWithJSP model and this program subscribe event from other iview.
    Other iview trigger event and store Data using data bag.
    When event trggered my portal component, load data and I wan to process with this data in PAI routine.
    So, Here is JSP file.
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean id="SalesOrderBean" scope="application" class="com.sap.training.portal.SalesOrderBean" />
    <script>
    function eventFired () {
         var Cust_No = EPCM.loadClientData('urn:com.sap.training.portal','Cust_No');
         var Sales_Org = EPCM.loadClientData('urn:com.sap.training.portal','Sales_Org');
         alert(Cust_No + " " + Sales_Org);
         var funcName = htmlb_formid + "_getHtmlbElementId";
         func = window[funcName];
         var ipField1 = eval(func("Cust_No"));
         ipField1.setValue(Cust_No);
         var ipField2 = eval(func("Sales_Org"));
         ipField2.setValue(Sales_Org);
         var form = document.all(htmlb_formid);
         form.submit();
    EPCM.subscribeEvent('urn:com.sap.training.portal',
                        'SalesOrder',
                        eventFired);
    </script>
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId">
              <hbj:inputField id="Cust_No" type="string" maxlength="20" value="" jsObjectNeeded="true" >
                 <% Cust_No.setVisible(false);%>
              </hbj:inputField>
            <hbj:inputField id="Sales_Org" type="string" maxlength="20" value="" jsObjectNeeded="true" >
                 <% Sales_Org.setVisible(false);%>
            </hbj:inputField>
            <hbj:textView id="welcome">
                 <% welcome.setText("Hello, " + SalesOrderBean.getCust_No() + " from " + SalesOrderBean.getSales_Org()); %>
            </hbj:textView>              
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Above code, I checked portal compoent load data when event trigger. (in statement : alert(Cust_No + " " + Sales_Org);)
    After then, I try to access that data using following code.
        public void doProcessAfterInput() throws PageException {
              InputField myInputField1 = (InputField) getComponentByName("Cust_No");
              if (myInputField1 != null) {
                   this.Cust_No = myInputField1.getValueAsDataType().toString();
              InputField myInputField2 = (InputField) getComponentByName("Sales_Org");
              if (myInputField2 != null) {
                   this.Sales_Org = myInputField2.getValueAsDataType().toString();
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              SalesOrderBean myNameContainer = (SalesOrderBean) myContext.getValue("SalesOrderBean");
              myNameContainer.setCust_No(Cust_No);
              myNameContainer.setSales_Org(Sales_Org);
    I can't acess it.
    Is there any problem ?
    Welcome to any comment.
    Regards, Arnold

    hi arnold
    try placing submit button...and use onClientClick="eventFired" in jsp file...try this out...
    hope it works fine...
    regards,
    purush

  • How do I redirect to a URL with JavaScript on submit in Adobe LiveCycle

    How do I redirect to a specific URL with JavaScript upon submit in Adobe LiveCycle?
    I already have the code in place where the submit event is handled, and just need the specific code to do the redirect.
    Standard asp.net-style redirects such as
    windows.location.replace(http://myURL.com);
    do not work.
    Any help would be appreciated.

    To be able to redirect a website with a submit button, you must have a custom submit button and insert the following line:
    app.launchURL("www.url.com");

  • C# control event handling with javascript

    How can I get javascript to execute for "onchange" / "OnSelectedIndexChanged" event instead of a CodeBehind method? I think "OnSelectedIndexChanged" event has to be handled by CodeBehind; but how can I replace that (or onchange) with
    a javascript event handler?
    I have the following in my xyz.ascx file:
    <asp:DropDownList ID="ddlTypeCar" CssClass="BatsRefAddressTypes" runat="server"
                      onchange="javascript: testAlert();"
                      OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged"
                      AutoPostBack="True" />
    I could not get the javascript to execute, even though I removed OnSelectedIndexChanged="ddlTypeCar_SelectedIndexChanged" and/or set AutoPostBack="false".
    Additionally, I tried added the following in xyz.ascx.cs Page_Load() method.
    ddlTypeOfAddress.Attributes.Add("onchange", "javascript: testAlert();");
    which didn't help.
    Thanks for your help in advance.

    Hi,
    you can control client events instead of server events with javascript
    look this url for more information
    http://www.w3schools.com/js/js_events.asp
    Regards

  • Process flow for Maintenance Event Builder integrated with PS

    Dear EAM  Master ,
    Good Day. Can anyone show me how's the process flow for Process flow for Maintenance Event Builder integrated with PS.
    Appreciate.
    Thank you.

    [SAP Help|http://help.sap.com/erp2005_ehp_05/helpdata/en/d7/d0b83a47d0c649e10000000a114084/frameset.htm]
    Thanks
    Narasimhan

  • Onunload event in javascript

    I want the user to log off as soon as the browser is closed..
    For it i m firing an onunload event in the body tag..
    this thing is working fine in Windows XP but not in 2000
    My code is
    function closeWindow()
    if(boolCloseWindow != "false")
    document.frmChgPwd.requestid.value = "LGF000";
    document.frmChgPwd.submit();
    return false;
    I m calling this function like this
    <body onunload="return closeWindow()">
    boolCloseWindow is a flag that i m setting to check some conditions
    when i call this event a requestid is set and the form is submitted to a servlet where the servlet does the task of deleting the record from the database.
    but its not working in Windows 2000
    please help

    Dear Professional,
    Good Morning. Are you looking for CMM Level - 5 or onsite oppertunity. Here are the correct match for you. Just send your updated profile to this id: [email protected]
    Also do let us know, if any of your friends intrested for this oppertunity.
    Regards,
    Swathi.

  • LIKE CALLING A PROCESS OF A PAGE WITH JAVASCRIPT

    I CAN CALL TO A PROCESS, WITH ONCLICK MAS JAVASCRIPT, AS IT IS POSSIBLE TO BE DONE?
    THANKS
    JUAN PABLO.......

    HELLO,
    I THINK YOUR CAPS LOCK MIGHT BE STUCK,
    you should try typing without it because in Internet etiquette it is considered rude and to be YELLING!
    Anyway, here is an example and code snippets of using Ajax to call an Application On Demand Process http://apex.oracle.com/pls/otn/f?p=11933:11
    Carl

  • Handling ActiveX events with Javascript inside BSPs

    Hi,
    Has anyone any experience with handling events from ActiveX objects (using the <object> tag) with Javascript, inside BSPs?
    I'm developing solely for the IE browser. Reading other threads, I know that the usual way this is done is via the below code excerpt:
    <i><script type="text/javascript" for="MyObject" event="Object_Event">
         js_function();
    </script></i>
    I create a HTML page, with the <object>, <script..for..event> tags, etc. Everything works fine when the page is run from my local system. However, when the code is run from WebAS (Activate then Test (F8)), the ActiveX object loads fine. But the javascript does not respond to events thrown by the ActiveX object.
    I wonder if anyone can share their experiences on this issue.
    Thank you.
    Amos

    It's the Skype4COM (v1.0.0.17) wrapper for the SkypeAPI, available at https://developer.skype.com/Download
    (Note: NOT the v1.0.0.16, which comes with the Skype ActiveX Tools package).
    I'm trying to use javascript to handle the event "CallStatus", thrown by Skype4COM, as shown in the code excerpt below.
    <i><script language="javascript" type="text/javascript" for="Skype" event="CallStatus(Call, Status)">
                 handleCallStatus (Call, Status);
    </script></i>
    It works locally, but not when in a BSP.
    It's rather interesting to mess with Skype calls from a webpage. Do let us know how your experience goes
    Amos

  • Can I auto submit a WebApp Search form (with javascript) so the results show up automatically?

    Can I automatically submit a WebApp Search form (with javascript) so the results show up automatically?

    yes. I also interested in how to do it.

Maybe you are looking for

  • Photoshop locks up trying to recover a file

    Earlier, I was working on a photo with many layers and tried to switch to mask mode when it locked up.  After an hour of waiting for it finish, I finally terminated PS via Windows task manager.  Now, every time I go to start PS, it tries to recover t

  • Retriving records with the date and time stamp

    I need to get all the records that were update between 08:36:06 AM and 8:36:09 AM on the12/15/2009 I am using this query it is giving me the right numbers (I think) because this condition GURMAIL_CPLN_CODE = 'UGAP', I would like something more precis

  • SPhone keeps turning on and off after restore???

    HI, I recently got a refurbished iphone 3gs.  I have tried to restore the last backup from my old iphone but once the restore is complete the phono continually turns itself off and on.  Does anyone know what I have done wrong?  Thanks

  • Inspiron N5050 owners name - how to change

    It's time for my almost daily stupid question. I have a Dell Inspiron N5050, I'm the original owner (bought new at Best Buy in 2012). I had the hard drive replaced under extended warranty and now under Users (when I go into the files on the hard driv

  • ITuneslibrary.itl does not appear to be a valid itunes library file

    My computer had problems and I had to reinstall all my programs. I just had to reinstall itunes 8.0.1.11. I uninstalled itunes and after reinstalling and importing my songs backed up on a flash drive I now get a message stating: iTunes file "iTunesli