I am trying to use bootstrap-datepicker with HTMX.
On date change, I want to use the date as an argument with hx-post, but I have no idea how to approach this.
I have a JSFiddle with a working bootstrap-datepicker, and am trying to post to /dateurl
on the changeDate
event, with the value of getDate
method.
Am I even close? I was trying to use the sortable example on the htmx site as a starting point. I guess I'm not understanding how to actually do something when the event fires.
Any help will be much appreciated.
thank you for this jsfiddle, this way it was easy to play around.
I found this solution.
<input type="text" hx-trigger="change" hx-post="/dateurl"
onchange="htmx.trigger(this, 'change')">
Not nice that the event needs to be dispatched manually. Maybe there is a better solution. But for me it did not work without the onchange
attribute.