FreeUser2019
FreeUser2019

Reputation: 13

How to display the today date in contact form 7 without datepicker

i want to display the current date (today date the date off submission of the form) in field date in contact form 7 without choosing it using the datepicker,i want also to disable the datepicker if it's possible.please help.

Upvotes: 0

Views: 4680

Answers (2)

Nico S.
Nico S.

Reputation: 116

You can simply use:

[date* your-date "today"]

With that you achieve the same result as with Ankit's solution.

Upvotes: 1

Ankit Panchal
Ankit Panchal

Reputation: 169

You have to add this script.

<script>
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);
   $('#MydatePicker').val(today);
   $("#MydatePicker").attr("min", today);
});
</script>

[date* your-date class:required id:MydatePicker] 

Please check it.

Upvotes: 3

Related Questions