Page
<custom:on_click xfdl:compute="toggle(BUTTON1.activated) == '1' ? 

(checkValidFormats('global.global.custom:errorsFound')!='0' ? 

set('BUTTON1.value',global.global.custom:errorsFound[0]) : 

set('BUTTON1.value','No Error')) : ''"></custom:on_click>
If you try the code you will realize that button's value also set to the first error found in the form. This is because global.global.custom:errorsFound array elements holds all the errors found in the form. inorder to access these errors you should refer to array elements starting from 0 upto the number of errors found in the form minus one.
Another useful function is countChildren(). We can use this function to count the number of errors found in the form. combining this function with forloops (for()) and strstr() functions can help us find exactly where the errors was found.
<action sid="myAction">
<custom:Num_Errors>-1</custom:Num_Errors>
<custom:loopCounter>-1</custom:loopCounter>
<custom:errorsFound_array>NA</custom:errorsFound_array>
<custom:onActivated xfdl:compute="

(toggle(active, 'off', 'on') == '1') 

? checkValidFormats('custom:errorsFound_array') 

+. set('custom:Num_Errors', '-1') 

+.for('custom:loopCounter','0',(countChildren('custom:errorsFound_array')-'1')) 

+. set('custom:loopCounter', '-1') 

+. set('active', 'off') 

: ''">2</custom:onActivated>
<custom:searchArray xfdl:compute="

(toggle(custom:loopCounter) == '1') and (custom:loopCounter != '-1') 

?strstr(get('custom:errorsFound_array['+.custom:loopCounter +.']'),'myPAGE')!='-1' 

? set('custom:Num_Errors', custom:Num_Errors + '1') 

: '' 

: ''">2</custom:searchArray>
<custom:activateTheButton xfdl:compute="

((toggle(custom:Num_Errors) == '1') and (custom:Num_Errors != '-1')) 

? set('PAGE2.myBUTTON.active', 'off') 

: set('PAGE2.myBUTTON.active', 'on') 

">2</custom:activateTheButton>
<active>off</active>
</action>
Assume the form consist of few pages. we are interested in the errors in myPAGE and we want the next button (for simplicity we refer to it as myBUTTON) only activated when there is no error in the page. In given code we set an action (called myAction) to first find about any possible error in the whole form. Then we set a for loop up to the last element in the errorsFound_array array and with in the for loop we search the sid of the elements using strstr() function. If the sid of the desired page (myPAGE) was found we dissable myBUTTON.
The code is written inside an action and action triggeres every time the focuse of the fields changed inside form. When the action is triggered the number of errors found inside the myPAGE page will be updated. inorder to trigger the action this line of code shgould also be included in the global part of the myPAGE page:
<custom:on_fouce xfdl:compute="toggle(myPAGE.global.focuseditem) == '1' ="

? (set('myPAGE.myAction.active', 'on')) : ''"></custom:on_fouce>
for an alternative approach please refer to this page.
<list sid="myLIST">
<itemlocation>
<x>100</x>
<y>100</y>
<width>500</width>
<height>150</height>
</itemlocation>
<group>ERROR_LIST_GROUP</group>
<value></value>
<custom:on_click xfdl:compute="toggle(value) == '1' and strlen(value) > '0' 

? set('errPAGE.goToError.custom:current_item_ref',value->custom:item_sid) 

+. set('value','') 

+. set('errPAGE.goToError.activated','on') 

: '' ">2</custom:on_click>
</list>
<cell sid="ERROR_0">
<group>ERROR_LIST_GROUP</group>
<value></value>
<custom:item_sid></custom:item_sid>
</cell>
<cell sid="ERROR_1">
.
.
.
<action sid="myAction">
<custom:onActivated xfdl:compute="

(toggle(active, 'off', 'on') == '1') 

? set('custom:counter', '1') 

+.set('custom:invalid_items_total',checkValidFormats('custom:invalid_items_array')) 

+. set('errPAGE.Num_Errors.value',countChildren('custom:invalid_items_array','option')) 

+.((countChildren('custom:invalid_items_array','option')-'1'>'9')?set('custom:numErrors','9') 

: set('custom:numErrors',countChildren('custom:invalid_items_array','option') - '1') )

+. for('custom:counter', '0', '9') 

+. set('active', 'off') 

: ''">2</custom:onActivated>
<custom:numErrors>9</custom:numErrors>
<custom:counter>9</custom:counter>
<custom:forLoopAction xfdl:compute=" 

toggle(custom:counter) == '1' and custom:counter <= custom:numErrors 

? set('errPAGE.ERROR_' + custom:counter + '.custom:item_sid', 

get('custom:invalid_items_array[' + custom:counter + ']')) 

+.((strlen(get(get('custom:invalid_items_array['+ custom:counter +']')+'.value'))!= '0') 

? set('errPAGE.ERROR_' + custom:counter + '.value', get(get('custom:invalid_items_array[' +

custom:counter + ']')+ '.custom:errorMessage') + ' an Invalid form item entry.') 

: set('errPAGE.ERROR_' + custom:counter + '.value', get(get('custom:invalid_items_array[' + 

custom:counter+']')+'.custom:errorMessage')+' a Mandatory form item and it\'s not filled.')) 

: set('errPAGE.ERROR_' + custom:counter + '.custom:item_sid', 'errPAGE.LIST1') 

+. set('errPAGE.ERROR_' + custom:counter + '.value', '') 

">2</custom:forLoopAction>
<custom:invalid_items_total>4</custom:invalid_items_total>
<custom:invalid_items_array>
<ae>a</ae>
<ae>b</ae>
<ae>c</ae>
<ae>d</ae>
</custom:invalid_items_array>
</action>
<custom:invalid_items_array>
<ae>a</ae>
<ae>b</ae>
<ae>c</ae>
<ae>d</ae>
</custom:invalid_items_array>
(bug report: if you enter "2" as the value of the second array entry the code will crash. Could be a bug in the API behind it)
<action sid="goToError">
<active>off</active>
<custom:current_item_ref>a</custom:current_item_ref>
<custom:dest_page_sid>b</custom:dest_page_sid>
<custom:dest_item_sid>c</custom:dest_item_sid>
<custom:onActivated xfdl:compute="

(toggle(activated, 'off', 'on') == '1') 

? set('custom:dest_page_sid', substr(custom:current_item_ref, '0', strstr 

(custom:current_item_ref, '.') - '1')) 

+. set('custom:dest_item_sid', substr(custom:current_item_ref, strstr 

(custom:current_item_ref, '.') + '1', strlen(custom:current_item_ref))) 

+. ((custom:dest_page_sid != getReference('', 'page', 'page')) 

? set('goToPage_BUTTON.custom:next_page', custom:dest_page_sid) 

+. set(custom:dest_page_sid +. '.global.custom:invalid_item', custom:dest_item_sid) 

+. set('goToPage_BUTTON.activated', 'on') 

: set(custom:dest_item_sid +. '.focused', 'on')) 

+. set('active', 'off') 

: ''"></custom:onActivated>
</action>
<custom:invalid_item></custom:invalid_item>
<custom:goTo_invalidItem xfdl:compute="

((toggle(focused, 'off', 'on') == '1') 

and (custom:invalid_item != '') 

) 

? set(custom:invalid_item +. '.focused', 'off') 

+. set(custom:invalid_item +. '.focused', 'on') 

+. set('custom:invalid_item', '') 

: ''"></custom:goTo_invalidItem>
<custom:errorMessage>The field 'Field Name' on 'Field Page' is</custom:errorMessage>
After you apply the given changes to your form you should have an ErrorPage? set up in your form. For more information I have also attached a testform with an ErrorPage? which is created by applying the above changes to the form.
Finally, I should thank and credit this work to the following names which helped me in coding and/or ideas needed to make an ErrorPage?:
Cayce Marston
Matt Campbel
Ed Lowe
Christopher Dawes
This is YourOwnSandBox topic.