Help With Calendar

I can't seem to understand how to take a element that is listed on a certain date and drag it to another date and have it update the date in the database when dragged..

Can someone help me understand this flow...

thank you

Have you already gone through the docs?

https://docs.wappler.io/t/app-connect-calendar-dynamic-events/

It's all done through the Dynamic Events.

2 Likes

Your link seems to be broken...

The correct link is:

https://docs.wappler.io/t/app-connect-calendar-dynamic-events/18828

There it's explained how to pass event data when using the dynamic events.

2 Likes

One thing you may need to look out for is formatting the datetime on update or move. You will need to format this to the same as your database datetime field within the update step using the server side formatter for date.

2 Likes

ok i have the veriables passing to the form that updates the date when i move the items...how do i get it to submit or should i use another way of submitting to the dabase?

it depends on the way you want to handle the changes...

  • The user (or you as an admin) can drag as many events he wants to another date? Or just one event?
  • The user (or you as an admin) updates and other information of the event (title etc..)?

Anyway, you could proceed in 3 ways (at least):
1) Instant update per event

  • Add a modal in your page and inside it add a serverconnect form with the info (inputs) that can be changed/updated from the user (event.start, event.end, event.title etc)
  • when the user drop/move or resize a calendar event, then the event's info are passed to the modal and open the modal with the new event date/size, update the title(*optional) and click the submit to update the event on the database
  • (in this case the form's serverconnect will be a single event update)

2) Update all the events changes done at the end

  • add a hidden serverconnect form after your calender and inside it add a formRepeat with the required inputs (event.start, event.end, event.title etc...)
  • add a modal (as way 1 above) but the submit will not trigger the serverconnect form. It will just updates the specific event (driven by the event.id) in the formRepeat
  • after the hidden form, add a button and on click you submit the hidden form with the formRepeat (an array of the all th events data that has been changed)
  • (in this case the form's serverconnect will be a multiple event update and handled with a repeat on the $_POST.event)

3) If you need ONLY to update the event date instantly when you DropMove or Resize an event, you could just

  • Add a serverconnect in your page that is No-Auto-Load and set its ction to the api you have created to update a single event
  • Add a PageFlow (Auto-Run is disabled) in your page and inside it
    1. add the variables ev_id, ev_start & ev_end under the PageFlow $params
    1. first thing in your PageFlow, validate the $params passed (ev_start, ev_end)
    1. load the serverconnect that you added in your page and pass its parameters from the PageFlow $params
    1. on your Calendar Drop/Move event, run the PageFlow and pass the event.id, event.start and event.end as $params

There are more ways and more complicated but I don't think that could fit to your needs...
Anyway, If you still have questions on above mentioned actions, drop them here.

1 Like

this solution worked perfectly....thank you i really appriciate it