Like Us Like Us Facebook Subscribe Subscribe us YouTube Whatsapp Share us Whatsapp Query Send your queries

Contact form 7 set default date and 7 days restriction

Contact form 7 set default date and 7 days restriction

In this tutorial we will learn how to set contact form 7’s date field restriction to today+7 days plus restrict to pick backward dates and set current value to Today’s date.

As we know contact form Date Field syntax is like given below

<label>Preferred date*
[date* preffered_date]

Now set minimum date

[date* preffered_date min:today ]

Now set date salection to upcoming 7days

[date* preffered_date min:today max:today+7days ]

Now going to add id and set the value using javascript

[date* preffered_date min:today max:today+7days id:datePicker]


    [text* full_name] </label>

    [text* grade] </label>

    [text* subject] </label>

<label>Preferred date*
    [date* preffered_date min:today max:today+7days id:datePicker]

    [text* timezone_location] </label>

    [email* your-email autocomplete:email] </label>

<label>Phone (WhatsApp/Telegram)
[number phone]</label>
    [textarea* message minlength:10 maxlength:600 ] </label>

<label>Attach file (Max. Size 10MB, allowed doc,docx,pdf,xlsx)
[file attachments limit:10mb filetypes:doc|docx|pdf|xlsx|PDF]

[submit "Submit"]

jQuery(function ($) {
   var now = new Date(); 
   var day = ("0" + now.getDate()).slice(-2);
   var month = ("0" + (now.getMonth() + 1)).slice(-2);
   var today = now.getFullYear()+"-"+(month)+"-"+(day);
$("#datePicker").attr("min", today);
5 1 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments