Monday, March 12, 2012

Css class of label and element on a form page

It doesnt seem possible to change the actual HTML above the <label> element of a label in a form page in APEX. And because of that I have created a little script which will update directly in the apex tables. This script should be used with caution since it is not safe to change the data in these tables manually.

What the script does, corresponds to going through all items manually making sure the attributes: "HTML Table Cell Attributes" of the label and "HTML Table Cell Attributes" of the element are set. The script will add the text : "class="html_table_cell_attr_label"" ,and the text: "class="html_table_cell_attr_element"" to all fields where it is missing. It will NOT replace the text in the field. 

update apex_040100.wwv_flow_step_items set
  cattributes = cattributes || ' class="html_table_cell_attr_label"'
where flow_id = 100
and cattributes not like '% class="html_table_cell_attr_label"%'
;

update apex_040100.wwv_flow_step_items set
  cattributes_element = cattributes_element || ' class="html_table_cell_attr_element"'
where flow_id = 100
and cattributes_element not like '% class="html_table_cell_attr_element"%'
;

Wednesday, January 18, 2012

Is this an error in Apex 4.1?

I have recently added a topic on the oracle apex forums which noone has answered (yet). I would like to hear others opinions on this.

Here is the link to the topic: https://forums.oracle.com/forums/message.jspa?messageID=10088724#10088724

The problem is that when you set a value of a page item on another page in a region button and the value has a space in it, the value on the receiving page replaces the space with %20.

To recreate you can do the following on a demo app at apex.oracle.com

  • Go to page 4 and create a display only item called P4_VAL 
  • Go to page 3 and create a button redirects to page 4 and set the value of "P4_VAL" to: "VAL WITH SPACE"
Run the app and see the value displayed on page 4 as: "VAL%20WITH%20SPACE" Also see the url: http://apex.oracle.com/pls/apex/f?p=60043:4:1914750686915384::NO::P4_VAL:VAL%2520WITH%2520SPACE Instead of just %20 as it would normally say, now it says %2520.

This must be an error?? 

Also, if I change the url to: http://apex.oracle.com/pls/apex/f?p=60043:4:1914750686915384::NO::P4_VAL:VAL%20WITH%20SPACE It works correctly.

So it seems that where it goes wrong is in the javascript redirect code of the button (link generation)

Update:
This has been filed as a bug and is tracked with Oracle bug #12971989. It will be fixed in the first patchset for apex 4.1.
Thanks to Anthony Rayner for answering me.

Monday, January 16, 2012

Tabular Forms - No Data Found error

I recently got the error "No data found" in my tabular form when trying to delete an item. I couldnt really find out why and searched it on google :)

Here I found http://oraclequirks.blogspot.com/2011/07/ora-20001-error-in-multi-row-delete.html

Which describes how you should be carefull with changing the order of items in a tabular form and it got me thinking. The tabular form must use some kind of javascript to find the checked items and from that find the primary key values. I was right it turns out. In my case I had a report on page 0, with a hidden item. That hidden item got the name f01 and id f01_0001, and as soon as I deleted this the tabular form started working.

So beware of having hidden items on page 0 with name f01 :)