Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oracle Apex Dynamic Action on button

Posted on 2013-06-27
4
Medium Priority
?
4,447 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 375 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 375 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

972 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