On a view I have two Date Input controls. I click on one of them and then a popup calendar is opened. Then I click also on the second Date Input control(without closing the popup calendar for the first one). When I do these two actions, I get both of the popup calendars opened.
How can I handle this control in order to have only one popup calendar open at a time?
While you wait for an official fix from Software AG, you can do the following workaround.
Basically, we want the calendar to be smart enough to understand that we are no longer interested in using it and instead we want to set a value on another control on the page (it could be a Drop Down, another Date Input, a simple Text Input etc.) and then automatically close itself.
As you may have already seen, one way of closing the Calendar without clicking its Close (“X”) button is by clicking anywhere on the page.
So, if you put the following javascript statement on the “OnClick” event of all other controls on the page, then you can be sure that the Calendar gets closed whenever we “move away” from the Date Input.
I just realised that my suggestion in previous post may not be able to resolve your issue specifically because Date Input Control does not have Client Side events configurable on it. So, when you click on a Date Input, you cannot get a hold on its “OnClick” event just by using the fetaures of the CAF Date Input Control.
However, this can still be achieved by using the JS Event Listeners and getting a reference on the Date Input Control.
I haven’t tested the following code, but this may potentially work with some tweaking.
var dateInput1 = document.getElementById('dateInput1');
dateInput1.addEventListener('click',function (e) {
$("#{activePageBean.clientIds['defaultForm']}").click();
},false);