This discussion is archived
6 Replies Latest reply: Jan 4, 2013 12:42 AM by Nicolette RSS

Refresh region after item is populated

DejanH Newbie
Currently Being Moderated
Hello.

We have a problem creating one application (using apex 4.1).

We want to create an application where user inserts some code (id).
After code is inserted into item, his record is displayed in a report (next region).
After the record is displayed, it should be inserted into database.
After submit, page is refreshed.

We have problems with refreshing report after the code is inserted.
Is it possible to have a few seconds between record is displayed and submitted to database.
So user can se it. Then it is automatically inserted and app is refreshed.

We created testcase on apex.oracle.com
workspace: livo
user/pass: test

I hope you understand the problem.

Thanks.


Regards,
Dejan

Edited by: DejanH on Dec 20, 2012 2:14 PM
  • 1. Re: Refresh region after item is populated
    Nicolette Expert
    Currently Being Moderated
    Dejan

    For the refresh use a dynamic action of type refresh.
    Triggering item is then item P1_EMP_NUMBER
    Affected item is then the region "Registration"

    By the region set "Page Items to Submit" to P1_EMP_NUMBER so the value gets submitted.

    So after showing the result of query it should be submitted without futher user interaction.
    Maybe the plugin timer can be used [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html#dynamic] see timer plugin

    The timer should then fire a dynamic action to submit the page. Or execute pl/sql that does the DML.

    If there is no user action between showing between refreshing the report and submitting why not doing the submitting directly and only show the end result?

    Nicolette
  • 2. Re: Refresh region after item is populated
    DejanH Newbie
    Currently Being Moderated
    Hello.

    I did already use dynamic action for refresh but it didn't work.
    I used dynamic event 'before page submit' and P1_EMP_NUMBER 'submit when enter pressed' property was set to 'yes'.

    But before page submit dynamic action didn't start.

    Thanks.


    Regards,
    Dejan
  • 3. Re: Refresh region after item is populated
    Joni Vandenberghe Pro
    Currently Being Moderated
    Your dynamic action set a static value of 1, since there wasn't an employee with id 1, even if your report refresh worked it wouldn't do the trick.
    I modified your dynamic action so when NW is clicked your value is stored to the session, and the report refreshed.

    What your asking about when a user submits the page it delays the submit for a couple of seconds to show data to the user is not possible with dynamic actions. If you really want to do this you have to use javascript, javascript has a timer event that can delay actions. More info about this at:
    http://www.w3schools.com/js/js_timing.asp
  • 4. Re: Refresh region after item is populated
    Nicolette Expert
    Currently Being Moderated
    Dejan

    I don't think refresing a report on page submit is going to work.
    Simple because a new page is shown before the region can be refreshed.

    So what I did is create a dynamic action on the change of the item. (When event = change)
    The action of the dynamic action is refresh.
    This refreshes the employees region.

    The region has a dynamic action with "when event" = After Refresh
    There are two actions
    * Show This shows the region.
    * Timer This is the plugin I mentioned in my earlier post.
    The settings for the timer are
    Action     Add Timer
    Timer Name     left empty
    Expire in x Milliseconds 1000
    Occurrence     once
    The affected element is the employees region

    As the end of the timer is reached the "Timer expired" event is fired.
    To submit the page a second dynamic action on the employees region is needed.
    For this dynamic action the "when event" = "Timer expired" en the action is "Submit Page"

    To hide the employees region I use a dynamic action on page load with action Hide.
    The show and hide actions are just for some flair.

    I have set up a [url http://apex.oracle.com/pls/apex/f?p=VANBAREN_FORUM_TRY_OUT:REFRESHSUBMIT&c=VANBAREN] demo here

    Nicolette
  • 5. Re: Refresh region after item is populated
    DejanH Newbie
    Currently Being Moderated
    Hello.

    Sorry for the late response.

    This is almost what i need.
    I need to enter the department, submit record to database and show that record for 3-5 seconds and clear region.

    Thanks.

    Regards,
    Dejan
  • 6. Re: Refresh region after item is populated
    Nicolette Expert
    Currently Being Moderated
    DejanH
    DejanH wrote:
    I need to enter the department, submit record to database
    Add a "execute pl/sql" action to the onchange dynamic action.
    The pl/sql code would be a DML action to submit the record.
    DejanH wrote:
    show that record for 3-5 seconds and clear region.
    Set the timer to 3-5 seconds. And use a hide action instead of the submit action I have used in the demo.

    Nicolette

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points