Thursday, July 30, 2009

APEX: $x_disableItem

I had an issue where I disabled a radio button (after selecting a value) using the APEX JavaScript function ($x_disableItem) but my selected value wasn't being saved.

After some testing I noticed that if I selected a value, disabled the radio, then submitted the page item's value would be null (empty string).


You can view an example of this here: http://apex.oracle.com/pls/otn/f?p=20195:2200

They're several ways to fix this problem. The easiest would be to "undisable" (i.e. re-enable) the item before the page is submitted. I know "undisable" is not a word but to re-enable a page item you need to call the disable function: $x_disableItem('PX',false);

3 comments:

  1. Hi Martin,

    that's a feature of the browser which doesn't submit items which are disabled. For text items you can use the readonly property, but unfortunately that doesn't work for radio and checkboxes :-(

    Patrick

    ReplyDelete
  2. Hi Patrick,

    Thanks for mentioning that this is a browser specific issue and not an issue with $x_disableItem.

    Martin.

    ReplyDelete
  3. Martin, I know you posted this all the way back in 2009 but I am having the same issue in 2011!

    It would seem that it is not browser specific but expected behavior for disabled inputs. Still a pain though!

    ReplyDelete