Retrieving DB data once the date is selected in a datepicker

fredfitaire 27 Jan, 2016

I'm looking for the js code (that I guess would be placed in Designer/Datepicker settings/Advanced/On date selected) that would retrieve some datas in the database, by simply choosing a date into that datepicker. I mean, without any action on a submit button or whatever, but once a date is chosen (and the datepicker automaticaly fades out) the DB content would be displayed under the datepicker.

Thanks !

NB: I wish I was a JS developer ... but unfortunately, I'm not 😉
GreyHead 27 Jan, 2016
Hi fredfitaire,

You have the right answer - you need to add an Ajax call to a separate form event that will return whatever it is that you need. There isn't anything built in to CF to do this but it's not too hard to do with custom JavaScript.

What do you need to send to the server - just the data? And what do you get back?

fredfitaire 27 Jan, 2016
Thanks Bob,

It's a simple form that allows to some users to declare their presence in a specific place and let others know about their intentions.
First a radio box with "I'll be there" and "I could be there"
Then a datepicker ("at that date")
Then a text box "from ... to" (time)
These 3 items are saved into my DB.
On another page, I build a table using a separate plugin called "Table JX" that retrieves into the database those 3 parameters plus the user name (the users are registered). On the top of that page, another datepicker to show at a certain picked date who will be present.

Is that enough clear ? Otherwise let me know.
fredfitaire 27 Jan, 2016
Sorry, I forget to tell you that my first question applies to the second datepicker.
GreyHead 30 Jan, 2016
Hi fredfitaire,

I don't think that the ChronoForms datepicker has an easy way to trigger an action when a date is selected. The JQuery UI datepicker has an onSelect method - see docs here that you can use to trigger an Ajax call to get the data you want.

This topic is locked and no more replies can be posted.