Monday, November 05, 2012

APEX 4.2 and Textareas

There is a change in behavior in Oracle Application Express 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, 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, Textarea page items are now properly including this attribute in the HTML for the page item.

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

But in APEX, 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 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, 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 today.

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


Mark Lancaster said...

Hi Joel

A question on the patched functionality.

Currently using 4.2 the maximum width defaults to 2000 if you don't specify a value.
For textareas based on database varchar2 columns, specifying a size matching the column size is appropriate.

For textareas based on clobs it's a bit more arbitrary, you would need to specify a size bigger than the largest expected value. Since 4.1 you can post more than the 32K limit you mentioned, so for clobs there are times when it's not easy to guess the max size. Your users would get understandably upset when data is not accepted.

A simple example is using the rich text editor to produce HTML for an eBulletin system. Typically 32K is very reasonable, but sometimes you will exceed this limit significantly.

It would be nice if you could suppress the maxlength property at the item level, rather than relying on the application level compatibility mode.

The compatibility mode addresses the upgrade issue, would you consider the item level override to suppress the maxlength property?



Joel R. Kallman said...

Hi Mark,

Thank you for the comment and suggestion.

We'll research this. At first glance, your suggestion seems to make the most sense and offer the most flexibility.

Thanks again.


Joel R. Kallman said...

Hi Mark,

Excellent suggestion. What you propose is already the behavior in the fix for APEX 4.2.1. As well, the PSE on My Oracle Support for this bug has been augmented today (06-NOV) to include this prudent recommendation.

Thanks again.


sri said...

What's the official public release date for the next version after Oracle APEX 4.2? (4.2.1)


Joel R. Kallman said...

Hi Sri,

There isn't any "official" date, but we hope to have the patch set out in the next month or two.