Monday, November 05, 2012

APEX 4.2 and Textareas

There is a change in behavior in Oracle Application Express 4.2.0.00.27 that I thought was worth making special mention of.

Most page items have a property named "Maximum Width".  The purpose of this attribute, as the item-level help states, is to "specify the maximum number of character users are allowed to type into this form element."  Thus, if you were to specify a value of 255, then end users theoretically would not be able to enter more than 255 characters for the item value.

Prior to Oracle Application Express 4.2.0.00.27, this attribute for Maximum Width was not emitted in the HTML for Textarea page items.  You could have had a Maximum Width of 255 or 4000 or 32000 - it didn't matter.  The amount of text that could be entered by your users was essentially unconstrained (up to the 32,000 limit that can be POSTed).  In Oracle Application Express 4.2.0.00.27, Textarea page items are now properly including this attribute in the HTML for the page item.

Prior to APEX 4.2.0.00.27, my Textarea named P2_RESUME, with a Maximum Width of 2000, might be rendered like this:



But in APEX 4.2.0.00.27, my Textarea named P2_RESUME, with a Maximum Width of 2000, will now render like this:


A number of internal and external customers have rightfully complained about Oracle Application Express 4.2.0.00.27 breaking functionality in their existing applications.  Previously, end users were able to enter a large amount of text in textareas, but now "APEX limits what can be entered by end users."  And this directly relates to the Maximum Width attribute, which most developers were able to safely ignore for textareas in the past, but in 4.2.0.00.27, it is very relevant.

I can offer the following suggestions and direction:

1) If you wish to query the APEX data dictionary for all items in your application(s) which may be impacted by this change, you can issue the query:

select application_id, page_id, page_name, item_name, item_element_max_length
  from apex_application_page_items
 where display_as_code = 'NATIVE_TEXTAREA'
 order by 1,2,3,4

2)  In the forthcoming Oracle Application Express 4.2.1 patch set, this Maximum Width property of textarea items will only be emitted when the application-level attribute Compatibility Mode is 4.2 or later.  Thus, if you are upgrading from Oracle Application Express 4.1.1 or earlier, the Compatibility Mode will not be set to 4.2 and your application behavior will remain the same.

3)  There is a patch set exception on My Oracle Support, Patch ID 15829665, which implements the above-mentioned "Compatibility Mode" behavior.  You can download this PSE (i.e., "one-off patch") and apply it to Oracle Application Express 4.2.0.00.27 today.

Note that this "maxlength" attribute for textareas is not enforced by Internet Explorer.