Hello
It seems to be working fine without the minDate. I tried with the [option] that you suggested but dosent do anything to limit the date, but it saves on the back end.
When i use the previous code without the option it shows disabled dates as i want but dosent save on the backend.
Btw i put this script at the bottom of the page
<script>
wptDate.init("#cred_form_12345_1", {
source: 'cred_form_ready_init'
});
</script>
and this on top of the page
jQuery(document).ready(function($) {
$(".testdate").datepicker({ minDate: 0 });
});
If it helps.
I'm seeing some errors where $.datepicker is not a function, so I'm not able to test. Can you resolve those? You should wrap any $().datepicker code in a jQuery document ready handler that receives $ as a parameter in the callback, or it will be fired before $ is ready. For example:
<div class="wpb_wrapper">
<script type="text/javascript">jQuery(document).ready(function($){ $(".testdate").datepicker( 'option', { minDate: 0 });});</script>
</div>
Got rid of the error which was the [
<script>
wptDate.init("#cred_form_12345_1", {
source: 'cred_form_ready_init'
});
</script>
]
and added your script on top of the page , but its still the same no change.
Any idea why it dosent listen?
Where can I find the wptDate.init script? I don't see it in the page source or in any of the asset files. Am I missing something?
It was at the bottom of the page but i removed it as i mentioned from the previous message cause as you said it was causing an error. Should i add it aggain? Video form id is 1518
but i removed it as i mentioned from the previous message cause as you said it was causing an error.
Sorry for the miscommunication, I didn't mean to remove that code. The errors I was referring to were not caused by the wptDate.init function directly. I was referring to the other script tags where you did not use a jQuery document ready handler wrapper around some datepicker code. You can see an example where I added the document ready handler here: https://toolset.com/forums/topic/input-field-of-date-is-read-only/page/2/#post-1309605
I did add your code the jQuery document ready handler wrapper on top of the page as you can see in the picture of the previous comments, but still the same.
With or without this code :
<script>
wptDate.init("#cred_form_1518_1", {
source: 'cred_form_ready_init'
});
</script>
I dont see any difference , it just gives an error in console.
~ReferenceError: wptDate is not defined[Learn More] add-request-new-job:1410:5
<anonymous> hidden link
Can you take a look ?
That indicates the code is fired before the wptDate object is ready. Try wrapping that code in a document ready handler as well:
jQuery(document).ready(function(){
wptDate.init("#cred_form_1518_1", {
source: 'cred_form_ready_init'
});
});
I changed the order of the two scripts [wotDate.init before the script that limits the date] and it works.
Thanks a lot Christian for helping me in this.
Have a lovely day.