Dynamic Action on page unload
Hi folks
On one page of my app, I would like to save several page items to session state if the user clicks a tab to load another page. I am doing this so that if the user later returns to the first page, their work in progress can be restored from session state.
As there are many items on the page and our internet connection is slow, I don't want to save each page item after it is changed or loses focus. I thought the "page unload" event would be perfect for this. However, it does not seem to work.
I have no condition attached to the event. I have defined one true action to be fired, which executes a null pl/sql block and submits the main page items to save. This technique works fine in other cases, but in this case the page items do not get saved.
According to firebug, I cannot even see the DA get triggered.
Does anyone have any tips for this kind of DA event usage, or a better alternative technique?
Thanks for any advice.
Regards
CS
Add another JavaScript true action that fires before/after the PLSQL displaying an alert message so you know if the D.A is triggered.
I created the same it seems to be working fine with redirects,page submits and even URL modification requests, and is showing the message before any page unload.
Similar Messages
-
How to use dynamic action to fill multi item on a page ?
Hi..
I want to fill multi items on a page so I build a dynamic action ( Execute PL/SQL Code ) to do it .The problem is that when the page loads I can't see any data and I tried to see the session values using debug and I found data. Moreover when I save the row I got these data saved.
So what is the magic there?
ThanksFirstly, to get the multi-select populated with "pre-selected" values the easiest approach is to use Computation or Process at a process point On Load Before Header or After Header or Before Regions.
All you need to do is populate your "Select List " page Item with : (colon) separated list of selected values. E.g is you want A,B and C out of A,B,C,D,E selected then get A:B:C into the Page Item.
If you have used Dynamic Actions, what is your event on which the action fires? For Dynamic-Actions the page (HTML DOM) needs to be existing , so it must fire after the page has loaded.
Regards, -
Is it possible in a before-page-submit dynamic action to cancel processing?
I have a page where when the user submits, I check certain conditions and prompt the user with a confirmation ("are you really sure you want to submit this...?") and if they press OK (javascript true) continue to submit as normal, else (javascript false) the page should stop submitting.
I know I can do this by putting Javascript code on whatever buttons I need to such that they're prompted from whatever appropriate button but I then thought it might be more elegant to just put it in one place in a before-page-submit DA.
So I figured that in my DA for a before-page-submit I'd try explicitly returning true or false thinking that I returned true it would continue to submit but if false it would stop submitting. Unfortunately no dice.
Example:
Dynamic Action
Before Page Submit
Condition (Javascript Expression): (this.data=="SAVE")||(this.data=="MULTI_ROW_DELETE")
var response=checkPbcDml();
alert(response); //for debugging and I do properly get true or false back
if(!response)
return(false);
else
return(true);So I'd like return(false) to stop the submission process (was only guessing that it'd work, and it doesn't). Is there any other javascript command that I could execute to cancel the submission processing?
Yes I know that I really can do this on my buttons and it'll work...
javascript:if(checkPbcDml())apex.confirm(htmldb_delete_message,'DELETE');
javascript:if(checkPbcDml())apex.submit('SAVE');...but was just hoping to do something in the DA as a matter of elegance to put code in one place rather than two places.
Edited by: gti_matt on Jun 14, 2012 10:30 AMtrent wrote:
Personally, I'd just try to utilise the confirm action - probably achieved by incorporating the checkPbcDml() function into the dynamic action condition, at the sime time you are checking the request value.Aha! That's it.
The "Confirm" DA action's OK/Cancel response is evaluated by the "Before Page Submit" and cancels the processing.
What I did was:
1. Looked at my old function's conditions:
function checkPbcDml()
if (($v('P265_FREEZE_FLAG')=='Y') && ($v('P265_PUR_MFG')=='M'))
return(true);
else
return(confirm("Part Bid Categories information will only be saved from this page for frozen &F182_MAKE_TEXT. parts.\nDo you want to continue with this action anyway?"));
}2. Appended them to the existing DA conditions that were evaluating the save or multi-row-delete request:
((this.data=="SAVE")||(this.data=="MULTI_ROW_DELETE")) && (!(($v('P265_FREEZE_FLAG')=='Y') && ($v('P265_PUR_MFG')=='M')))3. And created a Confirm action with that message text and removed my checkPbcDml() function. -
APEX dynamic action - How to hide an item after the page loads
Hello
I have a form with item Type, lesson and page. I want to create a dynamic action like "on page load" if Type = x then don't show lesson and page items. .
How do I say if Type=x then don't show lesson and page. otherwise show them.
Please note Dynamic action, Event=Page load
Thankscreate dynamic action like
Event:Change
Selection Type:Item
Item:Type
Condition:Equal To
value:X
Select Action:Hide
Select Items to hide
also create opposite false action
and click on page checkbox below action to yes
Hope this may helps
pars. -
Dynamic Action - Fire on Page Load problem
Greeeting,
i created report with dynamic action Event = page load and action = submit . Event scope = Bind,
But it is submitting page continously , and i want to submit once..
how i will handle this.. created example please click on link
http://apex.oracle.com/pls/apex/f?p=20294:3:1276651806269601:::::Hi,
>
Earlier on you said:
Page 1 Sales
Page 2 Sales Detail
items in sales page are product name id and rate.
<b>Product name on Page1 is linked with sales detail page 2.</b>
>
How? From your query this relation is not evident.
>
Now you say:
Parameters:
1- From Date
2- Date
3- Choose Area
>
You logic is rather mixed up. What is it that you want to achieve? What are the default values for the 3 parameters, if any? Which value on Page 2 is being set while navigating from Page 1?
Two wrongs do not make a right. So first of all abandon the DA that Sumbit Page on Page Load and focus on the fundamental issue related to your logic.
The suggested modified query below is NOT WHAT YOU NEED FOR YOUR REQUIREMENT but I am posting it so that you can at least get the report running and then work to fix your logic.
SELECT SS.OUTLET_ID,
SS.CAT_ID,
SS.ITEM_CDE,
SS.ITEM_NME,
SUM(DECODE(RETURN_IND,'N',ITEM_QTY,'Y',ITEM_QTY*-1)) QTY,
SUM(DECODE(RETURN_IND,'N',ITEM_QTY,'Y',ITEM_QTY*-1)*ITEM_RTE) AMT,
O.OUTLET_NME
FROM
(SELECT OSM.OUTLET_ID,
PI.CAT_ID,
PI.ITEM_CDE,
PI.ITEM_NME ITEM_NME,
OSM.RETURN_IND,
OSD.ITEM_QTY,
OSD.ITEM_RTE
FROM OUTLET_PRICE OP,
OUTLET_SALES_MASTER OSM,
OUTLET_SALES_DETAIL OSD,
POS_ITEM PI
WHERE OSM.OUTLET_SALES_MASTER_ID = OSD.OUTLET_SALES_MASTER_ID
AND OSM.OUTLET_ID = OSD.OUTLET_ID
AND OSD.OUTLET_PRICE_ID = OP.OUTLET_PRICE_ID
AND PI.ITEM_ID = OP.ITEM_ID
/* AND OSM.OUTLET_ID = :P2_SELECT_OUTLET
AND OSM.CONSIDERED_DTE BETWEEN :P2_FROM AND :P2_TO */
AND OSM.OUTLET_ID LIKE NVL( :P2_SELECT_OUTLET,'%')
AND OSM.CONSIDERED_DTE BETWEEN NVL(:P2_FROM,TRUNC(SYSDATE)-1) AND NVL(:P2_TO,TRUNC(SYSDATE))
UNION ALL
SELECT OSM.OUTLET_ID,
PI.CAT_ID,
PI.ITEM_CDE,
PI.ITEM_NME ITEM_NME,
OSM.RETURN_IND,
OSD.ITEM_QTY,
OSD.ITEM_RTE
FROM OUTLET_PRICE OP,
OUTLET_SALES_MASTER OSM,
OUTLET_SALES_DETAIL OSD,
ITEM I,
ITEM_CATEGORY IC,
POS_ITEM PI
WHERE OSM.OUTLET_SALES_MASTER_ID = OSD.OUTLET_SALES_MASTER_ID
AND OSM.OUTLET_ID = OSD.OUTLET_ID
--AND OSM.OUTLET_ID = :P2_SELECT_OUTLET
AND OSM.OUTLET_ID LIKE NVL(:P2_SELECT_OUTLET,'%')
AND OSD.OUTLET_PRICE_ID = OP.OUTLET_PRICE_ID
AND OP.ITEM_ID = I.ITEM_ID
AND I.CAT_ID = IC.CAT_ID
AND IC.TEMP_ITEM_ID = PI.ITEM_ID
/* AND OSM.CONSIDERED_DTE BETWEEN :P2_FROM AND :P2_TO */
AND OSM.CONSIDERED_DTE BETWEEN NVL(:P2_FROM,TRUNC(SYSDATE)-1) AND NVL(:P2_TO,TRUNC(SYSDATE))
)SS ,
OUTLET O
WHERE SS.OUTLET_ID = O.OUTLET_ID
GROUP BY SS.OUTLET_ID,
SS.CAT_ID,
SS.ITEM_CDE,
SS.ITEM_NME,
O.OUTLET_NME
ORDER BY ITEM_NMECheers, -
Set checkbox session state using Jquery / dynamic action
Hello Folks,
I'm trying a simple dynamic action to disable & set element value upon making a radio box selection.
What I'd like is:
a) if i chose "Vendor" as "Traditional" (default value) I would like to set the "SNAP" flag as Checked and "Status" textbox to "test for static value" (SNAP flag is not set, only works on Page load)
b) if i chose "vendor" as "Isilon" then "SNAP" flag should be greyed out (disabled) and "Status" textbox should be disabled. (Working as Expected)
Link to the page:
http://apex.oracle.com/pls/apex/f?p=73069:6:0::NO:::
Workspace: wksp_chandu
Username: test
Password:test
Dynamic Action
Identification
Page:
6. Check Disable radio
*Name(Value Required)
*Sequence(Value Required)
When
*Event(Value Required)
- Select Event -
Change
Click
Double Click
Get Focus
Key Down
Key Press
Key Release
Lose Focus
Mouse Button Press
Mouse Button Release
Mouse Enter
Mouse Leave
Mouse Move Page Load
Page Unload
Resize
Resource Load
Scroll Select
After Refresh
Before Page Submit
Before Refresh
Change Order [Shuttle]
Custom
Show unsupported...
*Selection Type(Value Required)
- Select Selection Type -
Item(s)
Button
Region
DOM Object
jQuery Selector
*Item(s)(Value Required)
Condition
- No Condition -
equal to
not equal to
greater than
greater than or equal to
less than
less than or equal to
is null
is not null
in list
not in list
JavaScript expression
*Value(Value Required)
True Actions
The following actions will be fired when the 'When' condition is met, or when it is 'No Condition'.
Edit
Sequence
Action
Fire On Page Load
Selection Type
Affected Elements
10
Clear
Yes
Item(s)
P6_SNAP
P6_STATUS
20
Disable
Yes
Item(s)
P6_SNAP
P6_STATUS
Add True Action
False Actions
The following actions will be fired when the 'When' condition is not met.
Edit
Sequence
Action
Fire On Page Load
Selection Type
Affected Elements
10
Enable
Yes
Item(s)
P6_SNAP
P6_STATUS
30
Set Value
Yes
Item(s)
P6_STATUS
40
Execute JavaScript Code
No
Item(s)
P6_SNAP
Add False Action
Thanks!
ChanduOops...I just got it working.. Thanks for your time. I was trying to set checkbox value via javascript code and somehow that wasn't working...Finally changed the setvalue to be based on "PL SQL expression" nvl(:P6_SNAP,1)...that seem to have worked.
Thanks again ! -
Theme 11, live scope for dynamic action not working in IE
Hello all,
I use theme 11, and I have a dynamic action on page 0 that fixes a region width, because it is too long to match the page width. I set the Event Scope to "live" because the region is a report and it has many rows and pagination is needed. When I have to go to page 16-30 from 1-15 and if there is a record which is longer than the current 15, page is partially refreshed and the width is changed, but that works for Mozilla and Chrome. In IE the dynamic action from page 0 is not triggered, in spite of the live event scope and I don't know why. Is there a way I can fix that problem?
Thanks in advance!Hi Ivan,
Thanks for the information, this is indeed an interesting case. I'm assuming you have 'Enable Partial Page Refresh' in the report attributes set to 'Yes'. Please let me know if this is not the case.
I don't think an event of 'Page Load' with a scope of 'live' is correct. The 'live' event is a way of saying, attach some behaviour to something on a page (eg a delete icon in a report row is clicked), and keep that behaviour 'alive' even if that part of the page is updated (eg the report paginates with PPR to the next set or results, and clicking on the delete icon in the report still works). However here, when the event is page load, I don't think specifying 'live' will do what you want.
What I think you're really interested in is indeed when the page first loads, but then when the report is refreshed via PPR. Therefore, I would try the following:
1) Change the dynamic action event to 'After Refresh'.
2) Select the report region from the 'When > Selection' attributes (ensuring your report template contains a id="REGION_STATIC_ID" attribute, otherwise the DA won't work).
3) In your 'Actions', ensure the 'Fire on Page Load' checkbox is checked.
So this says do the action when the page loads, then always after the report is refreshed via PPR. This will fire after pagination, sorting or a dynamic action refresh.
Interestingly (at least in my mind!), you can actually set the event scope back to 'bind' here. This is because as part of the DA framework, we purposefully attach the event handlers for report handling to an element that is not updated during PPR for pagination or sorting, it's higher up in the DOM tree. This gives slightly better performance than having to use 'live', which is more expensive computationally and yet still keeps the registered behaviours.
Also something else which may help, you can check if the DA is firing when expected by using a JavaScript console (eg in Chrome native Developer tools, Firebug with Firefox), with application debugging enabled (Application Properties) and switched on (via developer toolbar). Load the JS console, and you'll be able to see when the DA fires.
As far as the actual IE specific logic goes, I haven't looked into that too much yet, because I felt it was more important to get the DA firing correctly first, then see where we're at.
Regards,
Anthony.
Edited by: Anthony Rayner on Nov 14, 2011 11:06 PM -
Insert Dynamic Action of a Form is not working
Hello
I've designed a form and some ratio buttons and some other items. A button fires a dynamic action, first with a submit page true action and then with an insert statement action. The button submits the page too.
Sometimes the values of the form are inserted into the database correctly, but several times not. A new row is created every time, but in some case with no values in the columns. I tried several configurations but I couldn't find out what the problem is.
Is there a common reason for this issue?
Regards
FelixI now found a box in the insert dynamic action saying "Page Items to Submit". I added all Items there and now with three times page submission it now works. Or at least it works according to my testing.
Regards
Felix -
Leaving a Page fires "Page Unload" dynamic action?
Hi,
Which Dynamic Action fires when I am leaving a page.
I have a page with lot of items, I want to fire alert based on some condition when user leaving that page (suppose user clicks to say some TAB), I used *"Page Unload"* dynamic action, but somehow it's not working.
Is there any other Event I have to use?
Thanks,
DeepakThanks.. VC
but I cannot use that plugin as I have a Page which call other pages using iFrame and I am facing some issue..
I have created a separate Post for this but not able to resolve it till now.. Here is the Link.
Re: "IFrame Region" Plugin / Save Before Exit (3.0.2) - Dialog box - Question
Thanks,
Deepak -
Apex 4.2 dynamic action to refresh a report region on a different page
Hi,
I open up a pop up window from a report region. When the user is done in the pop-up window and closes it, can I trigger a refresh on the report region using dynamic actions without actually reloading the whole page? I know I can use dynamic action on a page to refresh the report region on the same page.
Thanks,
SinanSinan,
So long as the region to be refreshed is still loaded, you can do this. I don't know how you are loading your pop-up or unloading it but, the principle should be the same as what I provide below.
Assume that you have set the static ID for your report to MY_REPORT. (Be sure you have checked "Allow Partial Page Refresh" in the Report Attributes).
$('#confirmBox').find('div#userConfirmationMessage').html( '<span class="userInputRequest">Would you to Refresh your Report?</span>' );
$('#confirmBox').dialog(
autoOpen: true,
modal: true,
title: 'Refresh Conformation',
buttons:
'No': function ()
$(this).dialog('close');
'Yes': function ()
$(this).dialog('close');
$('#MY_REPORT').trigger('apexrefresh');
-Joe -
Creating two dynamic action in a page
Hi,
I have created two dynamic action under the page_items(p6_item,p6_item1 both are hidden).
First dynamic action under p6_item is action1.
properties of action Event-> Change
Selection_Type->Item
Item-> p6_Item
Value-> show
(When i Hit the button viewall it should only display region1)
True Action:
sequence->10, Action->Show, Fire->Yes, Selection Type->region, Region->region1
sequence->20, Action->Hide, Fire->Yes, Selection Type->region, Region->region2
False action:
sequence->30, Action->Hide, Fire->Yes, Selection Type->region, Region->region1
Second Dynamic action under p6_item1 is action2
properties of action Event-> Change
Selection_Type->Item
Item-> p6_Item1
Value-> show
(When i Hit the button Search it should only display region2)
True Action:
sequence->10, Action->Show, Fire->Yes, Selection Type->region, Region->region2
sequence->20, Action->Hide, Fire->Yes, Selection Type->region, Region->region1
False action:
sequence->30, Action->Hide, Fire->Yes, Selection Type->region, Region->region2
Here the problem is, when i hit the viewall button it is not displaying region1 instead region2 is displayin region1 is hidden. when i hit the Search Button it is displaying region2 , region1 is hidden. Foer me, When viewall hitted region1 should only display not region2. When Search button hitted region2 should only display not region1.Hi little foot,
I have created my page in apex.oracle.com. you can clearly see the issue which i am having in the page.
Workspace:listen
Username: [email protected]
Password:apex
Application Name: 45665
Page: page1 -
About creating an AJAX page with DML procedures using dynamic actions
About creating an AJAX page with DML procedures in APEX using dynamic actions. Help with limitations.
I want to share my experience, creating AJAX procedures in APEX 4.0.
LIMITATIONS
• How Can I Hide UPDATE button while I press NEW button. ??
• How Can I Hide CREATE button while I’m UPDATING A RECORD. ??
• How can I avoid multiple Inserts or Updates. ??
Here are the steps to create an AJAX Updatable Form using the sample table DEPTS. You can see the demo here: [http://apex.oracle.com/pls/apex/f?p=15488:1]
1) Create a blank page
2) Add a Report Region for departments (It shows the columns deptno, dname and loc).
3) Add an HTML Region and create the elements to edit a Department.
a. P1_DEPTNO (Hidden to store PK)
b. P1_DNAME (Text Field)
c. P1_LOC (Text Field)
4) You also have to create a hidden element called P1_ACTION. This will help to trigger dynamic actions to perform DMLs.
5) Open Page Attributes and in the HTML Header Section include the following code.
<script>
function doSelect(pId){
$x_Value(‘P1_DEPTNO’,pId);
$x_Value(‘P1_ACTION’,’SELECT’);
</script>
6) Modify the column DEPTNO in the report, to add column link. In the link text you can use #DEPTNO# , in target you must select ‘URL ‘ and in the URL field write javascript:doSelect(#DEPTNO#);
7) Create the following Buttons in the Form Region.
CANCEL Redirects to URL: javascript:$x_Value(‘P150_ACTION’,’CANCEL’);
NEW Redirects to URL: javascript:$x_Value(‘P150_ACTION’,’NEW’);
SAVE Redirects to URL: javascript:$x_Value(‘P150_ACTION’,’UPDATE’);
CREATE Redirects to URL: javascript:$x_Value(‘P150_ACTION’,’CREATE’);
8) Create the following Dynamic Action to Select a Department
Name: Select Dept
Event: Change
Selection Type: Item(s)
Item(s): P1_ACTION
Condition: equal to
Value: SELECT
Action: Execute PL/SQL Code
PL/SQL Code:
SELECT dname, loc
INTO :P1_DNAME, :P1_LOC
FROM dept
WHERE deptno = :P1_DEPTNO;
Page Items to Submit: P1_DEPTNO, P1_DNAME, P1_LOC
Don’t include any false action and create the Dynamic Action.
The first limitation, the value of page elements don’t do refresh so I added the following true actions to the dynamic action AFTER Execute PL/SQL Code.
Action: Set Value
Unmark *‘Fire on page load’* and *‘Stop execution on error’*
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_DNAME
Page Items to submit: (none) (leave it blank)
Affected Elements: Item P1_DNAME
Action: Set Value
Unmark *‘Fire on page load’* and *‘Stop execution on error’*
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_LOC
Page Items to submit: (none) (leave it blank)
Affected Elements: Item P1_LOC
These actions allow refresh the items display value.
9) Create the following Dynamic Action to Update a Department
Name: Update Dept
Event: Change
Selection Type: Item(s)
Item(s): P1_ACTION
Condition: equal to
Value: CREATE
Action: Execute PL/SQL Code
PL/SQL Code:
UPDATE dept SET
dname = :P1_DNAME,
loc = :P1_LOC
WHERE deptno = :P1_DEPTNO;
Page Items to Submit: P1_DEPTNO, P1_DNAME, P1_LOC
Don’t include any false action and create the Dynamic Action.
Include the following True Actions BEFORE the Execute PL/SQL Code true Action.
Action: Set Value
Unmark ‘Fire on page load’ and ‘Stop execution on error’
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_DNAME
Page Items to submit: P1_DNAME
Affected Elements: Item P1_DNAME
Action: Set Value
Unmark *‘Fire on page load’* and *‘Stop execution on error’*
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_LOC
Page Items to submit: P1_LOC
Affected Elements: Item P1_LOC
These actions allow refresh the items display value.
Finally to refresh the Departments report, add the following true action at the end
Action: Refresh
Affected Elements: Region Departments
10) Create the following Dynamic Action to Create a Department
Name: Create Dept
Event: Change
Selection Type: Item(s)
Item(s): P1_ACTION
Condition: equal to
Value: CREATE
Action: Execute PL/SQL Code
PL/SQL Code:
INSERT INTO dept(deptno,dname,loc)
VALUES (:P1_DEPTNO,:P1_DNAME,:P1_LOC);
Page Items to Submit: P1_DEPTNO, P1_DNAME, P1_LOC
Don’t include any false action and create the Dynamic Action.
Include the following True Actions BEFORE the Execute PL/SQL Code true Action.
Action: Set Value
Unmark *‘Fire on page load’* and *‘Stop execution on error’*
Set Type: PL/SQL Function Body
PL/SQL Function Body:
DECLARE
v_pk NUMBER;
BEGIN
SELECT DEPT_SEQ.nextval INTO v_pk FROM DUAL;; -- or any other existing sequence
RETURN v_pk;
END;
Page Items to submit: P1_DEPTNO
Affected Elements: Item P1_DEPTNO
Action: Set Value
Unmark *‘Fire on page load’* and *‘Stop execution on error’*
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_DNAME
Page Items to submit: P1_DNAME
Affected Elements: Item P1_DNAME
Action: Set Value
Unmark ‘Fire on page load’ and ‘Stop execution on error’
Set Type: PL/SQL Expression
PL/SQL Expression: :P1_LOC
Page Items to submit: P1_LOC
Affected Elements: Item P1_LOC
These actions allow refresh the items display value.
Finally to refresh the Departments report, add the following true action at the end
Action: Refresh
Affected Elements: Region Departments
11) Create the following Dynamic Action to delete a department
Name: Delete Dept
Event: Change
Selection Type: Item(s)
Item(s): P1_ACTION
Condition: equal to
Value: DELETE
Action: Execute PL/SQL Code
PL/SQL Code:
DELETE dept
WHERE deptno = :P1_DEPTNO;
Page Items to Submit: P1_DEPTNO
Don’t include any false action and create the Dynamic Action.
Include the following True Actions AFTER the Execute PL/SQL Code true Action.
Action: Refresh
Affected Elements: Region Departments
Action: Clear
Unmark ‘Fire on page load’
Affected Elements: Items P1_DEPTNO, P1_DNAME, P1_LOC
12) Finally Create the following Dynamic Action for the NEW event
Name: New Dept
Event: Change
Selection Type: Item(s)
Item(s): P1_ACTION
Condition: equal to
Value: NEW
Action: Clear
Unmark *‘Fire on page load’*
Affected Elements: Items P1_DEPTNO, P1_DNAME, P1_LOCI need some help to solve this issues
• How Can I Hide UPDATE button while I press NEW button. ??
• How Can I Hide CREATE button while I’m UPDATING A RECORD. ??
• How can I avoid multiple Inserts or Updates. ?? -
Is it possible to trigger action in backing bean on page unload event?
Hi,
There is a RichPopup in my page which has a Listener to save data or not by user choice "Data change detected, do you want to save those changes?"
I've tried with the javascript event 'window.onbeforeunload', but this way must be fit with a Servlet function which I am not allowed to use.
The attibute 'onunload' in the tag '<af:document>' seems useless. Even there is few description or example in the 'Tag Reference'.
So, is it possible to trigger action in backing bean on page unload event? Thanks in advance for helping.
VivaHi Frank
Thanks for helping, I've tried in your way. My codes are like below:
Page codes:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" clientComponent="true" title="viva test">
<af:resource type="javascript">
if (!window.addEventListener) {
// alert('window.addEventListener is not supported in IE8. Override it!');
window.addEventListener = function (type, listener, useCapture) {
window.attachEvent('on' + type, function() {listener(event)});
window.addEventListener('beforeunload', function (){performUnloadEvent()}, false);
function performUnloadEvent() {
var eventSource = AdfPage.PAGE.findComponentByAbsoluteId('d1');
//var x and y are dummy variables obviously neeed to keep the page
//alive for as long it takes to send the custom event to the server
var x = AdfCustomEvent.queue(eventSource, 'handleOnUnload', {args:'noargs'}, false);
var y = 0;
</af:resource>
<af:serverListener type="handleOnUnload" method="#{vivaTestBean.testOnUnload}"/>
<!--
<af:form id="f1">
<af:commandButton text="Unload" id="cb1" action="unload"/>
</af:form>
-->
</af:document>
</f:view>
</jsp:root>The backing bean codes:
public class VivaTestBean {
public VivaTestBean() {
public void testOnUnload(ClientEvent clientEvent) {
System.out.println("Thanks God");
}The first way which triggers a 'unload' event by clicking a button DO WORKS. :)
But when I changed the triggered way by changing the <af:document> to clientComponent as what you did, the 'onbeforeunload' event won't come out when I refreshed or closed the page.
That doesn't make sence, since I think the two ways to trigger a 'unload' event are the same.
Edited by: 841766 on 2011-3-7 上午1:13 -
APEX 4.0.1: restriction on maximum number of dynamic actions on a page?
Hello,
I would like to know if there is a restriction on the number of dynamic actions on a page.
I have a page with 29 dynamic actions. All works fine on the page.
If I create another dynamic action that only display an alert or does anything else, I have the error message HTTP 404 when I try do display the page.
If I delete an old dynamic action and create a new one then the page works fine.
So after several tests, it seems that there is a maximum number of DA on a page but can someone confirm that?
Environment:
APEX 4.0.1
Embedded PL/SQL Gateway
Regards,
SddcI stand corrected in that some limits are acknowledged:
http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/limits.htm
Where are people getting these ideas that normal form or "Codd" said that there was a
limit on columns and if you had more columns than a database product found convenient to implement that it was a 'design defect'? I took database management as an undergrad and in grad school and there was NO rule about number of columns. Anyone who says there is is shoveling pure bs. Even if there were such a rule, and there isn't, it is very inadvisable for a vendor who allows 1000 columns in a table in their database product to impose a limit that is 1/10 of that in an interface to their database. (And btw you can create a table (A 'wide' table, in sqlserver with 30,000 columns according to this:
http://msdn.microsoft.com/en-us/library/ms143432.aspx )
Artificially dividing up data instruments that were administered/collected at one time into pieces in separate tables, just to make a vendor's developers' life easier and more convenient, or just to keep the product from competing with the extremely extremely expensive "enterprise" products the vendor sells, is not acceptable.
Splitting highly related data into separate tables for no reason other than the
interface is not capable of handling it, creates a load of problems that would not otherwise
exist. What if the user enters less than all the parts? Then someone has to figure out if the parts not entered had no data recorded in the source or if they were simply accidentally skipped. Basically someone or a program would have to enter those pages and denote they had no content if that were the case. Much more logic, much more opportunity for error vs keeping data that was highly associated together.
A software vendor can apply whatever limits they want and no one can stop them, that's for sure. But what would be better here is making these more clear up front. This is a "rad" development tool for very small and not hugely complex forms and reports. Be clear and there will not be people royally steamed over spending their time and money evaluating a product that is not designed to do much of what people need it to do. This stuff should be in an FAQ and the top of the forum. -
Issue in execution of Dynamic action on change event
Hi,
Greetings.
I have scenario, where I have one select list (P_CATEGORY) and one shuttle control (P_ROOMS) on page.
The values of the shuttle list is being populated based on the selected value in select list.
The left pane of shuttle control's value based on LOV and source of the shuttle item is a plsql function, which returning colon separated value list.
So that returned values shown in the right pane of shuttle.
The LOV values are getting being populated using cascading LOV i.e based on the of Select List item. But the Shuttle source values not getting auto refresh and for achieving that I've created a dynamic true action on change event of Select list.
The dynamic action is with :
Action : Set Value
Set Type : PL SQL funciton body
Page items to submit : P_CATEGORY (this is select list)
Escape Special Character : Yes
Suppress Change event : Yes
Affected Elements -
Selection type : Item(s)
Item(s) : P_ROOMS
This is perfectly working on Firefox but not working on IE9 & Google Chrome.
I've debugged in both IE9 & Google chrome and found the dynamic action get executes ajax call and the values get back but not rendering on the screen. i.e not assigning to the item.
So can you please advice me what will be a workaround for this issue?
I am using Application Express 4.1.0.00.32 .
I'll appreciate your prompt response.
Thanks & Regards,
Jaydipsinh RauljiI don't understand why this is not working withouth seeing an example, there might be multiple processes working on the item.
Anyway if the value is returned check if the value is in the session aswell. If it is in the session but not on the page that means you will need to find a way to bring it from the DB to the page. You can do this by adding an action to your DA:
Action: Execute PL/SQL code
PL/SQL code: NULL;
Page Items to Return: your shuttle item
Maybe you are looking for
-
How do I install a printer that doesn't show up
I can't get my hp C4250 to show up so I can print. What might I be doing wrong? I have checked all the connections.
-
Hi, I want to save a keypair to a db using serialization. I want this db save rather than using keystore as the user may wander from PC to PC. Is there away I can protect the private key ( using a password etc)? Is there an implementation of the KeyP
-
Hi, I would like to know which the best form of if making paging using jsp, using only tomcat in my server. Thanks
-
HT204135 Printing email to PDF it will overwrite if other file with same name
When printing an email to PDF (in OS X 10.8.2) it will overwrite if another already printet with the same name, this did not happen in older versions. Why?
-
File Type and Size for Video iPod
I have the latest ipod that does it all, but I am a little concerned about the lack of control on the file type size. I can export a mp4 file with my own settings so it isn't such a large file but it won't load or play. I can convert the file but it