# How to find which item has been changed in APEX

*Note: I previously had a similar post about this which I somehow lost so re-writing it. The original link was: https://talkapex.com/2021/01/how-to-find-which-item-has-been-changed-in-apex*

By default APEX will warn users when leaving a page. When users modify a page with input and try to close the tab or refresh the page they will be shown the following dialog (*note: each browser will show a slightly different warning message):*

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700917230088/b2fc95d9-0ace-4659-b3e6-d07023737643.jpeg align="center")

The default options for this can be changed at the page level by toggling the `Warn on Unsaved Changes` option:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700917316162/2a0bef95-e2eb-4c7f-9dd2-de5ae4e940ac.png align="center")

Alternatively you can control each page item to determine if it'll trigger a warn on unsaved message:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700917354100/35b313a4-e112-46aa-9fc3-a7c2d0526ef2.png align="center")

There are some times when you may want to manually determine if a page item has been modified. In JavaScript the `apex.item` object contains a function called [`isChanged()`](https://docs.oracle.com/en/database/oracle/apex/23.2/aexjs/apex.item.html) Using the new*(ish)* `apex.items` object (which contains all the page items) you can quickly identify which page items have been changed. The following function will return an array of APEX item names that have been changed:

```javascript
Object.keys(apex.items).filter((key) => apex.items[key].isChanged());
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1700917690492/e134be7e-9672-4e3d-bdd8-5caf037a9e11.png align="center")

[Hayden Hudson](https://twitter.com/haydenhhudson) has a neat [snippet](https://gist.github.com/hhudson/c2d57dcbdbbc7e01021aada718fe4506#file-apex-detect-changed-items-js) that shows some custom warnings when a page item has been changed.
