This discussion is archived
2 Replies Latest reply: Dec 26, 2012 2:38 AM by Iris 314 RSS

dynamically change url of a button

Iris 314 Newbie
Currently Being Moderated
Hi there.

I have a button on a page, and that button opens another page within my application via url. I would like to dynamically alter the url of the button.

I'll explain further.
Lets say I have a button on page 50, and I'm using that button to get to page 100, and to set the value of an item on page 100.
Action is set to "Redirect to URL" and URL looks something like this: f?p=&APP_ID.:100:&APP_SESSION.:::100:P100_ITEM:&P50_VALUE.:
User can change the value of item P50_VALUE on page 50.

If I submit the page before clicking on the button, everything works fine. However, I have to do this without submitting the page, and I can't get the url to refresh, and to reflect the last selected value of P50_VALUE.

I'm using Apex 4.1.


Does anyone have any idea on how to achieve this?

Thank you and apologies for my English.
  • 1. Re: dynamically change url of a button
    Howard (... in Training) Pro
    Currently Being Moderated
    Dear 893137,

    Hi. Welcome. You seem to be new. (Hey, I'm a novice myself.) How about replacing your number ID with a more descriptive handle so it's not so impersonal?

    And what kind of a system as we talking about. It's possible the solution might differ depending?

    - Oracle version
    - APEX version -
    - Web server architecture
    - Browser(s) used -
    - Theme(s) used -
    - Templates used -

    Hmm. I suspect the variable P50_VALUE in the URL is evaluated from the Session State and not from any "working value" just updated by the user. If so, it won't be the new value until the page is submitted. As a novice, I'm often wrong so here is a great opportunity from someone to tell us there is a way to do this.

    You are not submitting the page, so you are just throwing away everything done on that page but the P50_VALUE? Right?

    Kind regards,
    Howard
  • 2. Re: dynamically change url of a button
    Iris 314 Newbie
    Currently Being Moderated
    I have asked for help from the author of the plugin and this is what he wrote:

    It works the same as clicking on the link, only you have to do something else first. Add a new action to your dynamic action - this one should be type Execute JavaScript and should fire before the Modal action.

    Use this action to set an attribute of the button that will have the URL that you want to open. You can use jQuery's "attr" method for this. Then configure the modal action to pick up on the attribute.

    There, in case somebody else in the future has the same problem. :)

Legend

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