Forum Stats

  • 3,854,216 Users
  • 2,264,340 Discussions
  • 7,905,609 Comments

Discussions

How do you make a Checkbox or Popup LOV readonly?

Glenda Hasley
Glenda Hasley Member Posts: 9 Blue Ribbon

We are on APEX 21.2

 

On the following Form page, the Completed field is a PopUp lov.

 When the user changes the Completed Field from No to Yes, a dynamic action is triggered.

 


This dynamic action triggers a confirm, several Set Values to set the values in the above yellow highlighted fields and Execute JavaScript Codes to make those fields readonly.

 

How do I make the Completed field readonly?

 

I tried the following:

$(document.wwv_flow.P6_ASSIGNEE_COMPLETE_FLAG).attr('disabled',true); (this set the Completed field to null)

 

document.getElementById("P16_ASSIGNEE_COMPLETE_FLAG").readOnly = true; (the user is still able to update the field)

Answers

  • Hamza Al-abbasi
    Hamza Al-abbasi Member Posts: 642 Gold Trophy
    edited Apr 26, 2022 2:01AM

    Create another Item with type hidden to hold P16_ASSIGNEE_COMPLETE_FLAG value before it's being disable and in Processing section create a process to assign the value from the hidden item to P16_ASSIGNEE_COMPLETE_FLAG :

    :P16_ASSIGNEE_COMPLETE_FLAG := :P16_HIDDEN
    
  • InoL
    InoL Member Posts: 10,068 Gold Crown
    edited Apr 26, 2022 1:37AM

    Anything you do in a form won't be saved in the database until you submit it.

    So, after all your Set Value DA steps, you should submit the page.

    Now it is a simple Read Only condition on P6_ASSIGNEE_COMPLETE_FLAG to render this item as a read only item when i's value is Yes.


    Completed field is a PopUp lov.

    Looks like a Select List to me. It's easy for a DA to make it disabled. "Disable" is a standard DA action.

  • Glenda Hasley
    Glenda Hasley Member Posts: 9 Blue Ribbon

    Hamza Al-abbasi I am very new to apex. Would you mind explaining to me how to create a process to assign the value from the hidden item to P16_ASSIGNEE_COMPLETE_FLAG ?

  • Glenda Hasley
    Glenda Hasley Member Posts: 9 Blue Ribbon

    InoL

    When the user selects the completed flag (I have tried a checkbox and Popup Lov) a dynamic action is triggered. The first True Value is a Confirm action. If the user clicks OK on the confirmation, it will populate all of those highlighted fields in the screen print. We do not want the user to be able to change the completed flag after they selected the OK on the Confirmation. We do not want the changes to be made on the database until they click 'Apply Changes'.

    I cannot use the Read Only configuration on the Page Item because an approver can reject the task. When an approver rejects the task, the completed flag is set back to No. I have to use 'Execute JacaScript Code' to make the field readonly (otherwise I get a session state error).

    When I use a checkbox or Popup LOV the field is still modifiable even though I have set it to readonly using Execute JavaScript code where the code is like the following:

    document.getElementById("P16_ASSIGNEE_COMPLETE_FLAG").readOnly = true;