Initialise field gformInitDatepicker

Hi,
I am experimenting using a plugin from github, https://github.com/oomphinc/gravity-forms-google-places . It is working very well. but I want to use it in a popup. In that same popup I have to use the gformInitDatepicker to reset the date field, works fine. So I have to do something similar with the Location field in this plugin.
Could you point me in the direction of the file which hold that gformInitDatepicker function so I can investigate how to do this and/or any other guidance/articles would be great.
Many thanks

What is the URL of the page on your site where we can see and test the form?

Hi,
Here is a page with the form on it, where both the date and location field work. On page.

Here is a page with a click to open up the popup. The date field works fine but the location field doesn’t. Popup

Thank you for taking a look

Hello. When I test the modal, I click in the datepicker and get the datepicker popup, but when I make a selection, the whole modal closes. I was not able to test the location functionality at all. It appears there are issues even before trying to test the location functionality.

Hi Sorry, I had set it to close on click. I’ve altered that configuration. Could you give it one more go to see if it now ok for you.
thank you

I was able to see the issue now. I understand what is going on and what you were asking. It appears that however you are embedding the form in the modal is not enqueuing the scripts, which is why you needed the gformInitDatepicker. You can find how that works by checking in the plugin folder “/gravityforms/js/datepicker.js” - take a look at the first two functions there.

The documentation for the location script you are using may have something similar that needs to be included when embedding the form with that functionality in the modal.

Thank you very much for reviewing that, I’ll take a look.
Happy to close this now.

1 Like