Calendar widget is not showing after text box is invalidated

Calendar widget is not showing after text box is invalidated

  

Hi

I have associated calendar with textbox. When user is not selecting any date, I am invalidating that textbox and giving error message as below.

But after that I am not able to get the calendar control after clicking on the textbox.


Please advice.

Thanks and Regards,

Suraj Borade

Solution

Hi Suraj,

 I also have same issue long back, What i did i took a container and place the text box and calendar widgets into it and refresh that container. It works fine.

-Hitesh-

Solution

Hello Suraj,

If you are doing an Ajax Submit, than the problem is probably that you are refreshing the input, but not the calendar. When you do this, you are changing the input id, but the id the calendar is using is still the old one. The JavaScript that captures the click and open the calendar doesn't work anymore, as it is bound to the old id. 

In this situation, the solution is the on provided by hitesh: refresh both the input as well as the widget. This way, both will be build again at the same time and the id provided to the calendar widget will be the correct one.

Cheers

Eduardo Jauch

Thanks Hitesh refreshing the container worked fine.

@Eduardo: Thanks for the great explanation. Can you please explain how id is getting changed after refreshing the input.

Hi Suraj

ID's are dynamicaly assign to page elements when the page or part of the page is built. So, every time an element is built (first time or with ajax refresh), it receives a new Id.

Than the problem when things are bounded together (through id), that obliges you to refresh both elements at the same time, to keep the bound ok.

:)

Cheers,
Eduardo Jauch

Thanks Eduardo. I forgot that doing ajax refresh also changes the ID. 

Cheers!!