0
votes

I'm blocking a select list with a dynamic action(after refresh with a jquery command ('#P987_X').attr("disable", true);) after adding a value to a table so i have a button with a submit action that after submitting it goes to the same page only has the report actualized with that new value.

My problem is that when it loads the page after the submit it blocks the select list but loses the value i have selected and i'm doing the branching with "save state before branching"

And if i don't block the item it does everything right and does't lose the value.

1

1 Answers

3
votes

This is a feature of HTML forms, not Apex-specific: the value of a disabled item is not submitted when the form is submitted. A work-around is to copy the value of the item into another hidden item when disabling it, and then when the page is submitted copy the hidden item's value into the disabled item.

I have created a demo of the solution here on apex.oracle.com. It works as follows:

Items

  • P19_SELECT is the select list. Its source value is set to &P19_SAVE., with source used "only when current value in session state is null"
  • P19_NUM controls whether the select list is enabled or disabled: P19_SELECT is enabled when P19_NUM = 0, else disabled. Default value is 0.
  • P19_SAVE is used to save the value of P19_SELECT. It could be a hidden item, I have made it visible for demo purposes.

Processes

When Submit button is pressed, the following PL/SQL page submit process runs:

:p19_num := :p19_num+1;
:p19_save := nvl(:p19_select,:p19_save);

The first statement increments the counter to make P19_SELECT disabled, the second saves the current value of P19_SELECT into P19_SAVE.

Dynamic Action

There is a single dynamic action defined as follows:

  • When Event: page load
  • When Condition none
  • Condition Type: Value of Item/Column in Expression 1 != Expression 2
  • Expression 1: P19_NUM
  • Expression 2: 0
  • True Action:
    • Action: Disable
    • Select Type: Item
    • Item: P19_SELECT
    • Fire on page load: checked
  • False Action: (none)

The Reset button clears the cache so P19_NUM goes back to 0.