Forum Stats

  • 3,836,825 Users
  • 2,262,197 Discussions
  • 7,900,120 Comments

Discussions

How to do a simple Yes/No Checkbox

Glenda Hasley
Glenda Hasley Member Posts: 9 Blue Ribbon

We are on APEX 21.1

I have a form that has a checkbox that uses the default Y/N.

When the user selects the checkbox, I see in the session state that it is changed from N to Y.

If the user changes their mind (before saving) and unselects the checkbox, the session state shows that the flag is still a Y.

How do I get the session state to recognize that it has been changed back to the original values?

When the checkbox is selected, there is a dynamic action to set other fields. If they unselect the checkbox, I need to set the values back to the original values.

Answers

  • Hamza Al-abbasi
    Hamza Al-abbasi Member Posts: 594 Gold Trophy

    You can check the checkbox value using client-side condition to check whether the value is Y/N.

  • Glenda Hasley
    Glenda Hasley Member Posts: 9 Blue Ribbon

    I am checking the checkbox value using a client-side condition to check whether the value is Y/N.

    I have two Dynamic Actions using the client-side condition.

    When the user selects Y the first time, the flag in the session state changes from N to Y. When it is a Y it populates other fields on the page dynamically.

    If the user changes their mind after selecting Y and the other fields gets populated (before doing a save), then unselects the flag, the session state remains Y. The dynamic action for when the client-server is N is never executed.

  • InoL
    InoL Member Posts: 9,978 Gold Crown

    The dynamic action for when the client-server is N is never executed.

    There is something wrong with your DA that it does not fire when the value is changed back to N. We cannot see your DA, so it is hard to say, maybe the client side condition. Debug your code!

  • Glenda Hasley
    Glenda Hasley Member Posts: 9 Blue Ribbon
    edited Apr 26, 2022 2:59AM

    InoL I am a new APEX developer. I am still trying to learn how to debug my code.

    I am testing a condition where the user selects the completed flag, The flag in the session state and Page Items changes from N to Y (which you see when you click on Session). All of the true actions in the first Dynamic Action Settings are executed.

    If the user changes their mind after selecting , then unselects the flag, the session state and Page Items remains Y. The dynamic action for when the client-server is N is never executed.

    There are two Dynamic Action Settings is on P16_ASSIGNEE_COMPLETE_FLAG

    The first Dynamic Setting contained the following. All True Actions under this worked. No False Actions worked

    Event: Change

    Selection Type: Items(s)

    Items(s) P16_ASSIGNEE_COMPLETE_FLAG

    Client-side Condition: Item= Value

    Item: P16_ASSIGNEE_COMPLETE_FLAG

    Value: Y

    The Second Dynamic Setting contained the following. No actions worked under this.

    Event: Change

    Selection Type: Items(s)

    Items(s) P16_ASSIGNEE_COMPLETE_FLAG

    Client-side Condition: Item= Value

    Item: P16_ASSIGNEE_COMPLETE_FLAG

    Value: N


    You mentioned, The dynamic action for when the client-server is N is never executed. Is it never executed because N was the original value?