This blog has been sitting idle for too long. So starting off the New Year with a quick find!

Here is the problem:

We need to loop through all page items to apply some logic on demand, and preferably we want to do it dynamically.

Taking a look at apex.page there is a function called forEachPageItem.

Function

This is not documented in https://apex.oracle.com/jsapi but it is public. This returns a function. Here is the internal function signature and comment inside of page.js as of APEX 20.2:

// For the given form call callback once for each page item in that form. This includes disabled and unchecked items.
// Page item elements are identified by having a name attribute that is not one of the well known names
//   input type=image not supported
// See comments in ajaxSubmit as well
function forEachPageItem( form$, callback, allElements )
Function Signature

It looks like can you pass a specific form as a parameter, but I am using what they use inside the page.js when the form parameter is null in other spots. This gives us back all page items on the page.

allItems = apex.page.forEachPageItem;
allItems( $( "#wwvFlowForm" ), function( el, name ) {
        console.log(el);
        console.log(name);
    }, true );
Solution

Hope this can help someone as the majority of solutions I see online regarding this revolve already looking at the metadata views via PLSQL.