Wednesday, 20 March 2013

A word of caution when using an SQL report with hidden items on the same page as a tabular form

tl;dr: if you are going to have a tabular form and an sql report on the same page with a hidden item, don't hide it using column attributes.

I've set up the following page to document the behaviour:

Basically, when you have a tabular form, elements are given a name attribute such as f01. Then, any processes can reference these elements. 

The trouble is, I have a SQL report, and I want to have the name column a link, which uses the ID column. I also don't want to leave the ID column showing, so I set it to hidden in column attributes.

Now if I try to delete a row in the tabular form, I will run into the following issue:

Now if I look at the source of the people report, I will see the hidden item has also named that field the same way as the tabular form, which will be causing a conflict for the MRU,MRD processes, and any custom process that uses the apex_application.g_f0x array.

The better solution that setting it to hidden in column attributes, is to leave the display as in column attributes to Display as text, and in column definition, set show column to No.

What this does is not have it in the report as a hidden input field, thus no need to set the name attribute of the input field. The downside of using this technique is it doesn't output the field into the page source, but I can't really see any need for this as we just have it there to build the link - unless you needed it in there for some dynamic action.