Friday, September 22, 2017

Show/Hide Update Button Based on Page Change

APEX 5.1 introduced a new JavaScript namespace called apex.page with some interesting functions.

In this post, I will be using the isChanged function in a Dynamic Action to hide the Apply Changes button in an Employee Form and show it only after some of the information on the page has changed.

Below is a short video that shows the final product. Notice this works with any type of items:


To implement this, create a Dynamic Action with the following properties:
  1. Name: Show/Hide Apply Changes on Page Changed
  2. Event: Change
  3. Selection Type: JavaScript Expression
  4. JavaScript Expression: apex.gPageContext$
  5. Client-Side Condition Type: JavaScript Expression
  6. JavaScript Expression: apex.page.isChanged()
  7. True Action
    • Action: Show
    • Selection Type: Button
    • Button: SAVE
  8. False Action
    • Action: Hide
    • Selection Type: Button
    • Button: SAVE
That’s it! Feel free to login into my Demo Application to try this (Username/Password = Demo/Demo).

It’s possible to apply the same concept based on changes of specific items. The JavaScript apex.item namespace has a similar function and the way to call it would be:

apex.item(‘Px_ITEM_NAME’).isChanged();

Until next time.

1 comment:

  1. This tip works great. I implemented the apex.item(‘Px_ITEM_NAME’).isChanged(); feature. I was 7 days trying to accomplish this goal. Thank you for this tip.

    ReplyDelete