Solved

Oracle Apex Dynamic Action on button

Posted on 2013-06-27
4
3,666 Views
Last Modified: 2013-07-21
I have a form page  (page 2) in an Apex App which is filled in periodically over time as events are actioned. When the whole task is complete, the user should click a button which automatically fills a couple of database items (also in the form, set as display only items) to indicate date completed and by whom. (app_user)

I have created a Button and a Dynamic action, but clicking the button causes the App to jump back to page one (a report with edit links to the form above). No fields filled or indeed anything saved..

Items:

P2_CLOSED_OUT  date
P2_CLOSED_OUT_BY varchar


Dynamic Action assigned to a button:

declare
    l_blank number;
begin
    case :P2_CLOSED_OUT
        when NULL      
-- set closed out items
             then :P2_CLOSED_OUT := sysdate;
                  :P2_CLOSED_OUT_BY := :APP_USER;
        else
-- already set, don't change
                  l_blank := 0;
    end case;
END;

don't mind if the button only performs this action, but if it can save the page as well then all the better.

Any pointers would be greatly appreciated !

thanks in advance
0
Comment
Question by:wspall
  • 2
4 Comments
 
LVL 1

Expert Comment

by:promisum
ID: 39281514
What is the "action" of the button.

It should say "Defined by dynamic action"

regards,
Richard
0
 

Author Comment

by:wspall
ID: 39292225
Hi Richard,

Sorry, haven't played too much with special actions/buttons to date.

Looks like the button I created was more of an "item" and hence didn't actually have the "Action when button clicked" properties. I have created a Region button instead now, have that property, but none of the options suggest "defined by Dynamic Action", only Submit Page, Redirect to page or Redirect to URL.

I had been stepping through the examples at http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r41/dynactions/dynactions.htm and have now discovered when the  "Defined by Dynamic Action" appears (under Creating a Dynamic Action on a Button section).

That being said still couldn't get the button to simply "set value" on two items and keep focus on the page, so I have created dynamic action on the fields in question. If there is a nice example to achieve my original objective I'd love to see it, I'm sure I'll be needing something like this in the future...

thanks again!
0
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 125 total points
ID: 39336604
clicking the button causes the App to jump back to page one (a report with edit links to the form above). No fields filled or indeed anything saved..

the user should click a button which automatically fills a couple of database items (also in the form, set as display only items) to indicate date completed and by whom. (app_user)


It sounds like you actually want the button to submit the page, but you're not choosing that action. You don't necessarily need a dynamic action anyway. Create a page process with the execution point on page submit, your button's action will also be Submit. In the process code, you put the code that you currently have in the dynamic action. You will probably want to add the insert code for the database table unless you already have that elsewhere.

After that, you have several options. If you want to stay on the same page, you can just create the post-submit branch to the same page.
0
 
LVL 1

Accepted Solution

by:
promisum earned 125 total points
ID: 39338381
If you want to prevent a URL from doing anything, you can give it a URL of "#"
Or something like "javascript: void();"

The DA on the item should still fire.

Start with a da that only executes a piece of javascript: "alert('yes');" You then can easily test if the DA is firing when you want it to.

Probably you might need to use a jQuery expression to get it to work.

Regards,
Richard
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question