Execute Oracle Apex Process from HTML link - oracle

I have some custom HTML that creates a table on my page with a bunch of images. For each image I would like to create a tag around it and call a process that has been defined in apex. How can I do this?
It seems that the only way to call processes is from a object that has been created by Oracle Apex such as a button item....

Two ways:
1) You can set up your link to submit the page with a request like this:
...
Then create a page process that runs when Request is equal to 'MYREQUEST'.
2) You can give your anchor an ID:
...
Then create a Dynamic Action that fires on the Click event for the jQuery selector '#myAnchor' and executes PL/SQL code.

Don't think you need the doSubmit Javascript function because if you go to the
report >> edit the column >> column link,
there is a Request field. You can put your request name there.
In page process condition type pick Request = Expression and put whatever you named the request.

I find javascript more flexible. For example you can implement confirmation dialog with customized text message like followings:
SELECT col1,
'submit' as link
FROM tab1
Regards,
Igor

Related

Why is my Oracle APEX DML Form stuck in edit mode and not going back to create mode?

I have created a page based on "Form & Report" template. So there is the Report page on which there is the create button. That create button leads to the form page which contains.
It is pretty simple. I don't know if there is a cache memory not emptying itself or if there is a setting that I have not properly set.
When I want to create a new database record, Oracle Apex behaves as if I asked it to update a record (though it still presents me with empty text fields).
Below the image of what's happening.
Create button of the Report
Buttons for edit are shown when I click the create button
Those edit buttons are shown instead of the buttons below => This means that the Apex software is behaving like I asked to edit a record not to insert a record.
Why is this happening?
You need to take a look at your create button. Is it passing a value to the form? If so, you probably don't want that. Is it clearing the cache of the form? If not, you probably want to clear it.
Also, on the form page take a look at your processes.. specifically the Automated Row Fetch (ARF) process.. what's the primary key that this process is using?
Also, take a look at the conditions for each button on your form. For the delete/save buttons you likely want a condition type of "value of item / column in expression 1 Is NOT NULL".
For your create button you would want the opposite.. "value of item /... IS NULL".
In both cases for the expression 1 you'd want to use the item that your ARF is leveraging.
#Bloomberg58 if you used the wizard that should not have anyway try to validate the create button in report page and the server-side validation of create and save button in form page

Oracle Apex 5: How do I redirect page when (dynami-action)button clicked?

I have a dilemna. I want to redirect the APP_USER to another page when a button is clicked. The thing is the button has a dynamic action with PLSQL body. The PLSQL does a few checks and validations and then redirects the individual to another page. How would I do that? Many thanks.
I suggest you use Branches because they are easier and better from a security point of view.
On your page create a button that will submit the page (has attribute Action=Submit Page) then create a Branch at the Processing point where you will select the page that you want the user to be redirected to.
Now to make this branch run just in some conditions go to the Condition attribute of the branch and at When Button Pressed select your button and at Type select PLSQL Function Body and add your logic there or select some other type that suits you best.

Joomla modal popup target url does not get session value

I have a problem regarding modal popup and session.
I have two component name test and test1 respectively.
In test there is a form in view in which i put "Anchor" tag with "modal" class. has also class name "class1".
When i clicked on Anchor tag it call click function(on click "class1") in which i put ajax code for set data using "Session".
$('.test').click(function(){
// Ajax code here for set data using session
});
with above function it also called modal popup. here targer url is seted which is the view of 2nd component which is "test1".
Here in test1 there is a view.html , we are getting session data here and displaying in view.
PROBLEM
Problem is that , here in 2nd component , in view i am getting session data but i need to click on button two time , only after i getting data properly.
When i click on it give me a old session data. and when i click on it second time it will give me a proper data.
What is the solution for above problem. if anyone know please let me know.
Session data is altered only after we click on Anchor tag.
Both thing is done on Anchor click , one is for set data in session and second is for modal popup. in popup i am getting data which set in session.
when is the session data is being altered?
Is it altered by ajax call too?
In this case, javascript, is unsynchronous. It doesn't wait for something to happen in order to fire the next line of code. In that case there are several techniques you may find to do so.

Oracle Apex Execution of Page Process

I Created the tabular form with two page process. i am in need to execute the first page process for created and modified rows and second page process need to executed only once.
how do i achieve this functionality
Thanks & Regards,
Priya
The is no inbuilt way, you would need to code something. For the Process to run only once create a hidden field, set it to one the first time the process to run and have this Process only run when the hidden field is 0.
The Process for Edit and Create should only be triggered when the Create/Edit buttons are run. You can have triggers for this in Apex. Look at the Conditions dropdown, select Request when Request is the name of the Submit button (e.g edit or add)

How to Use AJAX or Dynamic Actions to Refresh one Table on a Page in Oracle Apex?

I have two Main reports. Each report has a corresponding region with a Nonmain Classic report (so 4 reports total). Clicking on a link in each of the Main reports reveals details in its corresponding Nonmain report.
Currently, clicking on a Main report will reload the whole page, and all the PL/SQL and SQL has to refire from all 4 reports.
It would cut down on the SQL calls if only the nonmain report refreshed. I assume AJAX would be the best bet to accomplish this.
How would I go about doing such a task?
Thank you.
P.S., all four reports are determined by a PL/SQL function returning a SQL statement. All headings also are determined by a PL/SQL function returning a colon-delimited string.
With your previous questions in mind, your classic reports rely on the session state of some page items. You are setting the value of these items in your colunmn links.
If you want to cut out the submit of the page then you need a way for the anchor tags to not fire their default action and provide the value for page items to be set to a dynamic action.
You have to put this in the column link attributes:
onclick="return false;#" class="reportlink1"
You then need to pass on some data, and i suggest using data tags
data-value1="#COL1#:"
Create a dynamic action, firing on click and uses a jQuery selector .reportlink1
What needs to happen now is to provide the page items with their needed values
Add a true action to execute javascript:
var lValue1 = $(this.triggeringElement).data("value1");
$("P1_ITEM1").val(lValue1)
With the item value set, create another true action of type "Refresh" and set it to affect your secondary report.
The final step is then to set the "Page items to submit" on the secondary report. This will cause the report to submit the values of the set page items to the session and ensures that the sql will return the correct values when the region is refreshed.
For some reason, Tom's approach did not work for me; I assume it must be the idiosyncrasies of my page. If anyone stumbles upon this question, try Tom's method first, and if for some reason it doesn't work then try the following adaptation with AJAX in the dynamic action:
If your nonmain reports rely on the session state of some page items, and those items are set via column links from your main report, you must put this in the column link attributes to prevent the submission of the page and to pass the values using data tags:
onclick="return false;" class="reportlink1" data-value1="#COL01#" data-value2="#COL02#"
Create a dynamic action, firing on click and using a JQuery selector .reportlink1
Provide the page items with their needed values VIA AJAX. Add a true action to execute synchronous javascript:
var v1 = $(this.triggeringElement).data("value1");
var v2 = $(this.triggeringElement).data("value2");
var get = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=dummy', &APP_PAGE_ID.);
get.add('PX_ITEM1' , v1)
get.add('PX_ITEM2', v2);
gReturn = get.get();
get = null;
With the item values set, create another true action of type "Refresh" and set it to affect the secondary report.
Unlike Tom's solution, DO NOT set the Page Items to Submit on the secondary report.

Resources