search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Submitting a Form with event data

Asked by Doug D
4 years ago.

I would like to allow users to create a schedule then submit that data via a form and was wondering what the best way to do that is. For example, for one week, they create three events, then they click the save button and that information is transmitted to the server.

Is there a way to attach an <input type='hidden' name='xyz' value='abc'> to an event, so that if it is deleted/removed, then the input is deleted, removed as well?

Or should the events add inputs separately somewhere on the page via JavaScript and delete them when the event is deleted?

Or, is there some other way that it's done?

Thanks.

Answer posted by Dan Letecky [DayPilot]
4 years ago.

Normally, you only use forms when editing details of a single event using a modal dialog or in a standalone page.

When working with the Scheduler, every change is usually submitted immediately using a special AJAX call to the backend API.

You can take a look at this tutorial to see a hotel reservation application that uses backend calls to save the changes after user actions:
https://code.daypilot.org/27453/html5-hotel-room-booking-javascript-php

It is also possible to save the changes to a queue and submit them and once using a "Save" button (using an AJAX call) but I wouldn't recommend that unless there is a good reason to do so. Handling the queue and managing the state adds extra complexity.

Comment posted by Doug D
4 years ago.

I won't literally be creating events with this calendar, it's more of a weekly availability schedule (available from 8-5 Monday through Friday) for example.

Users will need to make several changes, then save them. I wasn't sure of the best way to take the events on the calendar and make them "submitable." The input tag was one idea.

Comment posted by Dan Letecky [DayPilot]
4 years ago.

If the calendar serves as a form here you can simply create the events in the calendar using the API (see https://doc.daypilot.org/calendar/event-creating/).

The events are stored in events.list so you will be able to either send it as a JSON string or convert it to a set of <input type="hidden"> fields on submit.

Comment posted by Doug D
4 years ago.

Ok thanks. The event tags will have data I need so maybe I will convert those into json upon submit.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.