Thursday, August 16, 2012

XPages Radio button OnClick Event Vs OnChange Event


There is problem(its not a xpage issue) in xpages Radio Button Group control when clicking on the radio button element and changing the value of a radio button.
I have analysed and created a small info about it.
Step 1: Create a table with at least 2 rows and 2 columns.
Step 2: Put any of the core controls in each cell and give a name to the table. Any of the cell should have the Radio Button Group.
Step 3: Now follow these operations.

Element (In whicih element) Partial refresh Event (In which event you want to code) Partial refresh element(Element to give inpartial refresh) Trigger event(event want to trigger) Result
(What happen)
Radio Button group onclick Any element except the table and itself On Click Works fine.
Radio Button group onclick Any element except the table On Change Works fine.
Radio Button group onclick Itself On Click When clicking on the particular radio button in the group, the value changes and immediately it will refresh itself and goes to the default value or previous value.
Radio Button group onclick Itself On Change Works fine.
Radio Button group onclick Table element On Click When clicking on the particular radio button in the group, the value changes and immediately it will refresh itself and goes to the default value or previous value.
Radio Button group onclick Table element On Change Works fine.
Radio Button group onChange Any element except the table and itself On Click Works fine. Value will change. No difference between onclick event and onchange event.
Radio Button group onChange Any element except the table and itself On Change Works fine. Value will change. No difference between onclick event and onchange event.
Radio Button group onChange Itself On Click Works fine. Value will change. No difference between onclick event and onchange event.
Radio Button group onChange Itself On Change Works fine. Value will change. No difference between onclick event and onchange event.
Radio Button group onChange Table element On Click Works fine. Value will change. No difference between onclick event and onchange event.
Radio Button group onChange Table element On Change Works fine. Value will change. No difference between onclick event and onchange event.


Note: In combination of the onclick event and onchange event, clicking triggers and takes effect first then the onchange triggers.
How to avoid this problem: Instead of refreshing the whole table (where the radio button group resides), you put those elements(those which needs refresh except the radio group) inside an another div/table and refresh that div/table element.

No comments:

Post a Comment