Code by Day | Explore By Weekend
How To Add A Date and Time Picker to the Divi Contact Form Tutorial by Pee-Aye Creative

How To Add A Date and Time Picker To The Divi Contact Form

Here's a super easy and very practical way to add a date and time picker to the Divi Contact form module. This is a great way to allow appointment bookings!

1. Add A New Field

In a Divi contact form of your choice, click to edit the settings. Click on the “Add New Field” plus icon. The Field Settings will open with an input field for Field ID as well as Title. You can write something like “Choose a Date and Time” in the title field, that isn’t important. The most important part is the Field ID. Add the following CSS class there and save the form.

pa-date-time-picker

2. Add A Simple Plugin

Now that you have set the Field ID in the Divi Contact form, let’s go to the WordPress Dashboard and add a new little plugin. Go to Plugins>Add New and search for, install, and activate the plugin called Date Time Picker Field.

3. Adjust The Settings

Next, we need to add a simple line of code to the plugin settings.

Go to Settings>Date & Time Picker and paste in the following line:

input[data-original_id='pa-date-time-picker']

It will look like this image below when you are finished. Be sure to save that.

Those are the most important parts for the tutorial that I need to show you. The rest of the settings need to be configured to your preferences. I suggest looking down through the basic and advanced settings to make sure the days, times, etc. are set how you want them.

4. Optional Design Improvement

We are using the method described in this tutorial on our call scheduling contact form. We hacked up the plugin styles a lot, and have pasted that code below for you to use if you want. You can customize the colors, etc. to your liking and past this in the Divi>Theme Options CSS box.

.xdsoft_datetimepicker {
   box-shadow: 0 15px 40px 6px rgba(0, 0, 0, 0.1)!important;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current {
   background: #2cba6c;
   box-shadow: #2cba6c 0 1px 3px 0 inset;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default:hover {
   background: #e03574!important;
   box-shadow: #e03574 0 1px 3px 0 inset!important;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
   color: #e03574!important;
}

.xdsoft_datetimepicker .xdsoft_datepicker {
   width: 350px!important;
}

.xdsoft_datetimepicker .xdsoft_timepicker {
   width: 100px!important;
}

.xdsoft_datetimepicker .xdsoft_calendar td,
.xdsoft_datetimepicker .xdsoft_calendar th {
   background: #ffffff;
   border: 2px solid #ebf8f1;
}

.xdsoft_datetimepicker.xdsoft_noselect.xdsoft_default {
   padding: 20px;
   border-radius: 10px;
   border: none;
}

.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div {
   background: #ffffff;
   border-top: 2px solid #ebf8f1;
   color: #333;
   font-size: 16px;
   text-align: center;
   border-collapse: collapse;
   cursor: pointer;
   border-bottom-width: 0;
   height: 36px;
   line-height: 36px;
   padding: 0 8px;
}

.xdsoft_datetimepicker .xdsoft_calendar td,
.xdsoft_datetimepicker .xdsoft_calendar th {
   background: #ffffff;
   border: 2px solid #ebf8f1;
   color: #333;
   font-size: 16px;
   height: 36px;
}

.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
   border-bottom: 2px solid #ebf8f1;
}

.xdsoft_time_box {
   border: 2px solid #ebf8f1;
}

The image below is how our contact form date and time picker looks.

25

Please share this post!

Nelson Lee Miller (aka The Divi Teacher)

Nelson is the owner of Pee-Aye Creative Co in the beautiful state of Pennsylvania. He loves helping small businesses, exploring, building websites with Divi, and teaching others.

Join Our NEW Divi Facebook Group!

The Divi Teacher Logo

Recent Posts

Leave A Response!

Subscribe
Notify of
guest
40 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Samar
9 months ago

Hey, that’s a great one!

Vicki Robinson
8 months ago

This is really a great tutorial! I’m trying to find something that will allow you to pick an arrival date and departure date (no times). Any suggestions?
I’m not a coder and finding it difficult to find an easy solution.

~ Vicki

Hans
Hans
7 months ago

I like the way you show how to use the date-time picker.
There two things I would like to know, is there a way to make a separate fields, one for the date and the other for time? And is it possible to change the placeholder text to something custom in stead of the current date/time?

Thanks for the fine tutorial.

Elba
Reply to  Hans
7 months ago

Yes Hans, on the plugin’s basic settings you can mark “keep placeholder” and it will display the text that you put on the form.

Willem Prinsloo
Willem Prinsloo
7 months ago

This filed does not have a placeholder option… How can we fix this? Pretty useless if we cannot change the placeholder…

Tom
Tom
7 months ago

Hi and thanks for the tips!

Everything is working well for me.

However I am wondering if you have any idea why it doesn’t work when I put the additional CSS in my child theme CSS sheet (instead of the parent one) ?

Thanks

Thomas

Tom O'Neill
7 months ago

Hey – this is awesome thanks – I can see the date/time picker populating but it’s behind some other layers/overlayers – any ideas on how I can ‘bring it to front’ essentially?
Thanks,
Tom

Lucas Lopvet
Lucas Lopvet
Reply to  Tom O'Neill
6 months ago

add the z-index CSS rule, and set it very high.

Gerard
5 months ago

Hi,
Great tutorial.
I was looking for the option of adding a date Picker inside the Divi Contactform.
Date for arrival and departure.
In this case, your original (Divi) text will be override by the date.
So a client can’t see were to fill in date for arrival or departure.

Gerard

Nelson, Thanks for your response.
The plugin and the CSS did the trick.
I’m satisfied.
Thanks again.

gio
gio
4 months ago

Very useful and interesting.
Your items are always of superior quality.
Congratulations, it was useful for a customer.:-)
Thank u buddy!

Christina
4 months ago

Thank you for the detailed tutorial. It really helped!

Gio
Gio
2 months ago

Hi. Thanks for this tutorial, really crazy. I ask you one thing: do you think you could use a field id where to show only the date and another where to show only the time? Thanks so much

Gio
Gio
2 months ago

I have seen that on Smartphone the data module exits the screen. Did you notice it?
Tnx

Mark
Mark
2 months ago

Hi there! Thanks for this tutorial. I would love to implement it, HOWEVER it is not mobile-friendly. When you are on a cell phone, the date picker calendar hangs off the side of the phone screen and you can’t get to the rest of the dates. I went to your actual website to try it on my iPhone and it’s off the side of the screen. Do you have any code you could update this tutorial with in order to make this mobile friendly? If it doesn’t work well on cell phones, it’s not really a complete solution for me.… Read more »

Mark
Mark

Thanks. I went in and implemented this on a test website this morning. If you don’t add any width information, the picker fits on a phone just fine. I decided to go in and give it a defined width of 325px so that it’s guaranteed to fit down to an iPhone 5. Also, I discovered that you can pretty much get away without using !important tags if you just put “body .xdsoft_datetimepicker” at the beginning of each CSS selector. The only times I had to use important was when adjusting hover colors. For some reason, the dev used their own… Read more »

Vic
Vic
1 month ago

This is a great plugin! I was wondering if how could it work if the form has 2 fields that require date and time like “Start date (field 1) and End date (field 2)?

Thank you!

Bassam Disi
1 month ago

Hello, date time Picker plugin is a greet one.
Please what I have to do to make clendor, time mobile responsible?
thanks

Bassam Disi

Thank you very much for your reply.

I have treid with this syntax:

.et_xdsoft_datetimepicker .et_xdsoft_timepicker .et_xdsoft_time_box {

 display: flex;

 justify-content: center;}

but no changes, the same problem, can you pls help me.

I attached shott screen, thats shows the situation on mobile

100105872_562842094420190_5351962522821853184_n.png
Bassam Disi

thank you for your recommendation. It works

Audrey
Audrey
17 days ago

Hi! I’m wondering how I would use this plugin for 2 fields in the same form. I’m not sure how to use the selector for 2 differences ids.

Shop Our Divi Products!

Child Themes • Plugins • Layouts

Visit The Shop

become partners with Pee Aye Creative

Partner With Us

We are looking for you!

Learn More

Divi Tutorials On YouTube

Subscribe to our helpful Divi videos!

Visit Our Channel

Browse By Hashtags

Divi Tutorials
0
Would love your thoughts, please comment.x
()
x

Pin It on Pinterest

0

Your Cart