Monday, November 05, 2012

APEX 4.2 and Textareas

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:

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.

5 comments:

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?

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.

About Me

My name is Joel Kallman. I am the Director of Software Development at Oracle, and I manage the development and product management of Application Express (APEX) at Oracle. I've been at Oracle since 1996, and my VP Mike Hichwa and I created Application Express in 1999. My passion is to make customers extraordinarily successful with the Oracle Database, PL/SQL and Oracle Application Express.