I am facing an issue in Oracle Apex (v5.1).
I have a dialog page that opens up from the parent page on clicking of an icon. On Closing the dialog page,my parent page submits on the event 'Dialog Closed'
and a process which runs on the processing of the submit of parent page which seems to be not working.
In that process,I have certain APEX_ITEMS whose values are being set on submit of the parent page. Is there any way to make the process run?
Extra Description : I have an Interactive report which is fetched from a table say 'Temp', the report has links in some of the columns.
When a user clicks the link he is redirected to a modal page (while setting an application variable say 'APP_VAR' to zero) and user can modify some data there.
In the modal page when user clicks 'Submit' button a process runs and updated the temp table and sets value of 'APP_VAR' to '1'
and then page is refreshed. On the same modal page there is a Dynamic Action written on 'Page Load' with server side condition of 'APP_VAR' = '1',
this Dynamic Action closes the modal page with 'Close Dialog' action.
Now when the modal page is closed on parent page there is a dynamic action written on 'Dialog Closed' event which submits the parent page.
Also there is a process 'Update Parent' on condition of 'APP_VAR' ='1' which updates the 'temp' table with all the values from parent page (As user
can change some of the values in the report.) and sets APP_VAR to 0.
All of this is done in order to keep the temp table updated with values from both pages.
But when modal page closes the parent page refreshes before 'Update Parent' process is completed leading to loss of any changes made in parent page.
How can I run 'Update Parent' before the page reloads? please keep in mind that before 'Update Parent' runs the report data needs to be submitted
to session state in order to get the updated data.
Case 1
Why do you not put the "Update Parent" process together with the dynamic action that submit the page? You would need two true actions in this dynamic action.
The first one would execute its PL / SQL "Update Parent".
The second would submit the page
or
Case 2
Or if you want to keep "Update Parent" in a process, just call it in the page submission (if necessary bind it to a button), put it in the correct order of execution (by setting the sequence number). In the dynamic action submitting the page define a button name for this submission (if necessary).
Example Case 2:
After closing the page I need to execute 3 processes. So, I link these 3 processes to a button, if necessary I put the conditions of the server.
After the submission:
10 - Process 1 (when I click the x button)
20 - Process 2 (when I click the x button)
30 - Process 3 (when I click the x button)
So I need to define in my dynamic action that submit page the name of the button associated with this submission (Fill in the "Request / Button Name" field).
*Hide this button.
Related
I have a value of a field on page 1 that I need to pass to page 2 (modal dialog).
The field is changed on page 1. and I can see it's got updated on the page and when I print its value in debug messages.
When I'm clicking the button, with the action "Redirect to Page in application", the value on page 2 is the initial value of the field, and not the updated one, is this a bug?
what can I do?
I don't want to use dynamic action or things like "prepare_url" because of many reasons.
Thanks.
That is not how a link works. What you are seeing is not a bug, it is expected behaviour. The link is rendered when the page is rendered and will have the item values at render time and a calculated checksum (depends on settings) based on those values. It will not pick up any changes.
The "traditional" way to do this is the following. Assumptions: Need to navigate from page 1 to page 2 and set P2_ITEM on page 2 to value of P1_ITEM on page 1.
Create button (let's say button name is MYBUTTON) of type "Submit Page"
Under "Processing", create a branch to page 2.
For "Page or URL" pick page 2 and set P2_ITEM to value P1_ITEM.
For "Process point" pick "After Submit"
Under "Server Side Condition", select "MYBUTTON" under "When Button Pressed".
Since this is a branch your page has been submitted and all the changes you made to P1_ITEM will be picked up. The fact that page 2 is modal does not affect this, APEX will take care of that for you.
As an alternative to Koen Lostries excellent explanation, in some cases it is also possible to have the target page load the item from the source page.
Ensure that the item is being pushed to the session, for example by using a dynamic action with the items to submit option, but do nothing else in this dynamic action.
Then, when page 2 opens, simply add a pre-header-process, that makes something like :P2_ITEM := :P1_ITEM;
In my experience this approach is easier than doing a redirect in a dynamic action, as there is no declarative option for that and you often need hand-written javascript to do that.
in Oracle Apex I have a page where I want to edit individual records. To do this, the user selects a data record and then clicks the [OK] or [IGNORE] button. Here I have defined that the page is to be sent and then an update and insert takes place under PROCESSING. But he works "logically" one after the other. When I click [OK] an insert and update should take place and when I select [IGNORE] only an update without insert in a table should take place. Whats the best way to do this?
Process lets you create a Server-side condition which - additionally - offers you to choose which button it is related to.
Therefore, create two processes, each for its own button. Doing so, process will fire only when its button is pressed.
There are multiple options:
Create one page process per button and put a server side condition on each process (server side condition = When Button Pressed). Same answer as Littlefoot.
Create a single page process and in your source you manage the different cases. On submit, the value of the REQUEST is the name of your button. So your page process code could be
IF :REQUEST = 'OK' THEN
--code to execute when OK is pressed
ELSIF :REQUEST = 'IGNORE' THEN
--code to execute when OK is pressed
END IF;
You'd want to put a serverside condition on this of type "Request is contained in value" with a value of "OK;IGNORE". This will yield true if button OK or button IGNORE is pressed.
I have created a page in oracle apex where I have multiple regions and each region has a Submit page button.
Each submit has an ajax callback associated with it.
Will clicking on any one submit, also execute the other ajax callbacks?
In other words, when we click a Submit page button in one region, is it exclusive only to that regions ajax callback or will it execute all ajax callbacks of that page?
Button name determines value of the REQUEST attribute. If you look at the process values, you can set the "Editable Region" (which shows which region is associated with this process), as well as the request itself (under the "Server-side condition" properties; see the "When button pressed" and "Type").
So, if you create your own process which does something and set properties described above, each SUBMIT button should affect only its own region.
Unless I'm wrong, if there's only one SUBMIT button (created with its default settings) on the page, it'll affect all regions.
I have an Oracle APEX page that collects data via a classic report with apex_item dynamically generated items. Something like this:
select apex_item.radiogroup(qt.save_position, 1, qt.answer, null, null, null, null) col01
from xxpay_360_questions qt
where qt.questionnaire_id = 21
I then save the answers using a submit button that uses "Submit Page" and calls PL/SQL to insert/update the dynamically generated items from above. Something like this:
insert into xxpay_360_answers values (apex_application.g_user, APEX_APPLICATION.G_F01(1));
commit;
My question is how can I also do a transition to the next page of dynamically generated items (since I only have 50 apex variables to play with per page) when the submit button is clicked.
The submit button only has options for "Submit Page" and "Transition to Page" and not "Submit Page and then Transition to Page".
Is there a way of transitioning via PL/SQL as part of the submit code? Or is there an event that can transition after the page has been submitted?
Also how does this work with errors and the nice "Saved" fly over that apex has?
You need to create a Branch, on the after processing region:
Then you need to set as branch point: On Submit After Processing (After Computation, Validation and Processing) and the branch type as: Branch to page
Then specify the page number where your going to:
And finally you can set the branch to be fired only if one particular button is pressed and if one particular condition evaluates to true:
I think that would cover your needs.
But if you want to do it with PL/SQL you could do something like this:
Replace the page ID with the actual page Id to which you want to redirect the user.
BEGIN
IF(CONDITION)THEN
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:10:&APP_SESSION.'); /*Replace 10 with actual Page Number*/
apex_application.stop_apex_engine;
ELSE
htp.init;
owa_util.redirect_url('f?p=&APP_ID.:20:&APP_SESSION.'); /*Replace 20 with actual Page Number*/
apex_application.stop_apex_engine;
END IF;
END;
Or you could use the APEX_UTIL.REDIRECT_URL procedure.
if you are using APEX 4.2 refer the APEX_UTIL reference from here.
You can use:
apex_util.redirect_url(
p_url => 'type your url here'
);
This effectively calls in the owa_util. redirect_url and automatically calls apex_application.stop_apex_engine.
I have been tasked with re-creating an old PL/SQL Web Toolkit front end in Application Express (Apex).
I would like to display a popup after the page is submitted and after computations and validations.
The page can be submitted by clicking a button OR by hitting enter.
I have googled and got a modal popup working (called by javascript) but I can't seem to call it at the right point. I can call it on submit (before the validations etc.) but not after the validations.
I have tried creating a branch to URL at the correct processing point and then have the URL set to:
javascript:openForm();
But then I get a page will not display error.
Can anyone out there explain how I could do this?
Apex Version: 4.0.2
Oracle 10g
I suppose what you want to do is to perform the validations, have values submitted to session state, but not execute further processes.
However, when you submit the page it is sent to the server; and everything you see in the page processing region will sequentially fire. There is no way to halfway through the processes call a javascript function, since basically you are not on the clientside anymore.
What you can do is to create a branch after your validations to the same page. Redirect to it but provide a REQUEST value, for example OPENFORM.
Create a dynamic action, firing on page load, with a true action that executes javascript and opens up your modal page. Then set the condition on your dynamic action to Request = Expression 1, providing the request value to Expression 1 (OPENFORM).
(Note that this is the Conditions region, and not the 'Condition' field of the 'When' region)
This should cause the page to be submitted, validated, then re-loaded but with a request value, and the dynamic action firing, opening your modal page.
Just a point of interest:
If you have actual processes on this page though, then be careful with the Enter key. Buttons by default submit to session with the request value set to their name, and thus making it possible to conditionally execute processes or branches. The enter key does not submit with a request value set i believe. So if your branch is conditional, the enter key might simply skip over it.