Editing an event is slightly more complex than creating an event. We need to populate the edit form with the values of the event. However, because jquery-week-calendar
only records the id
, start and end times, and title
, the event data does not have any of the extra fields, such as the body
field, which are required to fill in the form.
To get around this, we wrap the form generator in an inline function, which is called after the server has been requested to supply all of the event's data.
To expand further on that, when we are asked to show the event editing form, what we need to do is to retrieve the data from the server, and send it to a callback function, which will generate the form and display it.
We will use an inline function in this case, as the code is mostly unique and is only used in this case. So, it makes sense to not create a public function out of it.
As a reminder, an inline function is a function that does not have a name, and is defined as a parameter to a...