I'm working on an inherited site where I have a sprout form and am adding additional fields. I have added a date/time field to the form with the settings in this screenshot.

enter image description here

In my template where all other fields are working I have added the following.

{{ craft.sproutForms.displayField('contact.targetProjectDate') }}

This field does not display and there is nothing in the source either.

Please advise


In the end I switched it to a default text field and used jQuery datepicker.

  • This is the simplest solution. If you were to expand the Field dropdown it would show the Date/Time field in a 'Custom Fields' dropdown. Custom Fields require that you either write an integration to add support or update your base templates with custom HTML to handle the DateTime field. Nov 30 '17 at 1:34

Not exactly a direct answer, but this is where my first search started me.

To save a Date/Time field into craft using a jQuery dateTime picker, you can create a small plugin and place this in the init method of the primay plugin file (Craft 2x).


public function init()

    craft()->on('sproutForms.onBeforeSaveEntry', function (Event $event) {
        if (craft()->request->isCpRequest()) {
            // Entry was saved from within the CP so we can ignore it.
        } else {
            if ($event->params['isNewEntry']) {
                $entry = $event->params['entry'];

                // Get the current time zone from the system.

                    'eventDate' => date('Y-m-d', strtotime(craft()->request->getPost('fields.eventDate'))),
                    'startTime' => date('Y-m-d H:i:s', strtotime(craft()->request->getPost('fields.startTime'))),
                    'endTime' => date('Y-m-d H:i:s', strtotime(craft()->request->getPost('fields.endTime'))),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.