In a page I have made with Apex there is check box. The users want this check box to be checked by default. So the check box was created with a static LOV: STATIC2:;Y. To ensure that the check box was checked by default the default value 'Y' was entered.
This did not function as expected. When the check box was unchecked it returned checked after submitting the page. So the users could not uncheck the check box and so in fact it was useless because it always had but one state: checked.
What happens? When a check box is not checked, its value is not posted to the webserver. Because Apex gets no value for the check box item, it sets the value of this item to null. But when the value is null and a default value exists, the item should be set to the default value. Ergo, once checked, always checked.
Once I realised this the solution is quite simple:
- create a hidden item Px_FIRST_TIME with no default value
- create a pre-region process, that checks on the content of Px_FIRST_TIME. When the item value is null, it is the first time this page is called and the check box should be set to checked. Furthermore the Px_FIRST_TIME should receive a value to signal, that after this time it is not the call to this page (in this session).
No comments:
Post a Comment