I am having an issue with multiple custom controls on the same xpage and was wondering if anyone else was seeing the same issue.
Here is how to create the issue.
-
Create a custom control with an edit box. In the onChange event of the edit box, simply get it’s value and store it in a variable. Nothing more than that.
-
Create an xPage and place a button on the xpage. Make the button do something with SSJS so you know it was pressed like setting a value of a field on the form.
-
Place the custom control you created on the form more that once.
-
Display the xpage and change the value of one of the input boxes on the xpage.
What was happening to me is that the button only works every other time. If the custom control is placed on the xpage only once then the button works every time. If the onChange event in the edit box is removed then the button works every time.
This will only happen if you have SSJS in your onchange event that is peforming a full refresh and your button is peforming a partial refresh. If you let the onchange events partially refresh, it should work. Also, it looks like the onchange events are fired when you LEAVE the textbox, so when you change it, do not leave, and push the button, it doesn’t work anymore as you said. But it did! It just fired the the full refresh the onchange event of the textbox and therefore ‘skipped’ the event from the button (because of the full refresh, the button onclick event will get a new id somehow).