solspace / craft-calendar

Calendar for Craft: The most reliable and powerful event management plugin for Craft.
http://docs.solspace.com/craft/calendar/v5
Other
15 stars 16 forks source link

Can not create event via front end "Start / End Date Cannot be Blank" #267

Closed ambidustrious closed 7 months ago

ambidustrious commented 7 months ago

Describe the bug or issue you're experiencing Trying to create a new event via the front end - using a stripped version of the demo code - below

{% set eventId = "new"%}
{% set event = craft.calendar.event(eventId, {
    loadOccurrences: false
}) %}

{% if event %}
    {% requireEventEditPermissions event %}

    <form method="post" id="newReservation">
        {{ csrfInput() }}
        <input type="hidden" name="action" value="calendar/legacy-events/save-event" />
        <input type="hidden" name="redirect" value="{{ (siteUrl~"reservation/{id}")|hash }}" />
        <input type="hidden" name="eventId" value="{{ event.id }}" />
        <input type="hidden" name="slug" value="{{ event.slug }}" />

        {% if errors is defined %}
            <div class="form-group row">
                <div class="col-sm-5 col-sm-offset-2">
                    {% for fieldErrors in errors %}
                        {% for error in fieldErrors %}
                            <div style="color: darkred;">&middot; {{ error }}</div>
                        {% endfor %}
                    {% endfor %}
                </div>
            </div>
        {% endif %}

        <strong>Name</strong><br />
        <input type="text" name="title"  value="Test Event"  placeholder="{{ "Title"|t }}"  class="form-control" />

        <strong>CalendarId</strong><br />
        <input type="text" name="" value="{{entry.propertyCalendar.id}}" class="form-control" />

        <strong>Start Date</strong><br />
        <input type="text" name="calendarEvent[startDate][date]" value="3/28/2024"   class="form-control date-picker" />

        <strong>End Date</strong><br />
        <input type="text" value="3/30/2024"  name="calendarEvent[endDate][date]"  class="form-control date-picker"  />

        <strong>Multi Day</strong><br />
        <input type="text"  id="multiDay"  name="calendarEvent[multiDay]"  value="1"   class="form-control" />

        <strong>All Day</strong><br />
        <input type="text" id="allDay" name="calendarEvent[allDay]" value="1" class="form-control" />

        <strong>Phone</strong><br />
        <input class="form-control" name="fields[renterPhone]" type="text" id="form-input-title" placeholder=" " value="9049626020" required>

        <strong>Email</strong><br />
        <input class="form-control" name="fields[email]" type="text" id="form-input-title" placeholder=" " value="greg.wineman@dlpcapital.com" required>

        <br />
        <button type="submit" class="">
            Submit
        </button>
    </form>

    <br /><br /><br />  

{%endif%}

When I submit the form... I get the following errors: · Start Date cannot be blank. · End Date cannot be blank.

Craft & Plugin Info (please complete the following information):

ambidustrious commented 7 months ago

name="calendarEvent[startDate][time] and name="calendarEvent[endDate][time] were required. This isn't well documented