Wednesday, 13 May 2015

Tabular forms and "Select ALL" check-box

Issue in APEX with tabular forms

Have you come across something like this before? Appreciate your feedback


Situation is a simple tabular form and a requirement from a client to implement select all check box similar to the one above -> "Printed" that should let you select all rows once that check-box is ticked.

Can be any simpler than this right? Well it turned out to be a tricky beast that we still haven't able to find an answer for. 

It is fairly easy to make JavaScript call to mark all check-boxes in Printed Column with 
<input type="checkbox" onclick = "$f_CheckFirstColumn(this)">
but problem arises when you try to submit the form using standard ApplyMRU process. 

Clearly you would expect for APEX to be able to submit something like this, especially since it normally handles rows that are checked by a user.

For some reason all rows selected in this way do not get over to database. 

I am not quite sure if this is a bug in APEX or a "session state" problem but nothing that we tried couldn't make a form to save All selected rows that JavaScript has triggered.

For this reason I wanted to write a blog  post to see if you experienced something similar to this. I would highly appreciate any feedback about it. 

I am aware that check-boxes in tabular forms are a tricky thing and have created numerous processes that loop, validate and what not but I never experienced something similar to this.

Workaround for now seemed to be in standard On Submit PL/SQL process where we manually are updating rows returned by this report. Not the ideal way but it sort of fits the purpose.

Appreciate your thought.