#1
Hi DC I cant get the datepicker to work inside a modal - appears to be a JS conflict. Cheers Gary
#2
Hello Gazbo, Can you post or describe the conflict, any errors? Is what you are describing is a modal in a modal? Possible solution is to have a different modal id Dan
#3
It's okay. No need to post code. I've seen this before. So, here's what's happening. The code for making the datepickers work is being initialised by some javascript. That code looks for elements with a certain class name (e.g., 'datepicker') then it applies some JS magic to those date-pickers. The problem that you've experienced is a problem that I have personally experienced too. I don't have a fix yet, unfortunately. However, I do know the general strategy for writing a fix. The way to fix this is to have JS add event listeners to your datepickers immediately AFTER the modal has appeared. If you can figure out how to do that then you're solved. If you cannot figure out how to do that then I'm afraid you're gonna have to wait. I'm currently fixing this site (which is a mess) and it's a challenge for me to think of something more urgent. If your situation is urgent then I can offer personal help but I'm only doing that for members of the Fellowship or my all new (YouTube) Insider Club at youtube.com/davidjconnelly. If you think I'm worth the cost of a Happy Meal then you've got me.
#4
Cheers for that DC, thought it was something I was missing. Not urgent as its for a Create/Edit form for client and will divert to separate page until fix comes along. Kind regards Gary
#5
Okay. That's super cool. Cheers.
#6
Hi guys. Lots of people struggle with this 'datepicker in a modal' issue but I have just got it to work by initialising the datepicker after the openModal function. At this point, the target text input control is 'in scope' and it pops up on demand and is behaving itself. I also tried bubbling-up the control's click event and it got messy. Anyway, it can be done.

I have wrapped the startup section of the trongate-datetime.js file in a new function and moved a few vars outside it. Then in my Ajax .done section I call openModal() and initTGDatePicker().



Here is the Ajax where I make the call:


Hope this helps and saves you some time. BTW Trongate is amazing - thank you David!

Regards, John.