Reputation: 13
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
Reputation: 116
You can simply use:
[date* your-date "today"]
With that you achieve the same result as with Ankit's solution.
Upvotes: 1
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