An example of a checkbox:
In my application I want to do an interactive search whenever the checkbox is checked.
So, how do you know if the checkbox is checked? Let's try with an example.
- Create a new "Check Box" item and give it a name, for ex. P26_CHECKBOX.
- In the List Of Values, put STATIC2: ;Y (this checkbox doesn't have a label, but will return the Y value whenever the checkbox is checked)
- If you look at the Session State (in the developer toolbar) of the item after a submit of the page, you see the checkbox item has a value of Y when it's checked...
- So let's try $x('P26_CHECKBOX').value -> it returns: undefined
- The above doesn't work, because APEX is putting a number after the item. In my example: $x('P26_CHECKBOX_0')
- If you try with $x('P26_CHECKBOX_0').value, it return Y or with $x('P26_CHECKBOX_0').checked, it returns true... and that's what we'd like to have
- See it in action here