Skip Navigation

[Resolved] Input field of date is read only

This support ticket is created 5 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 8.86 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 24 replies, has 2 voices.

Last updated by Christian Cox 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1309431

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.

#1309605
Screen Shot 2019-08-05 at 9.43.38 AM.png

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>
#1309725
code datepicker.PNG

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?

#1309771

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?

#1309775

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

#1309779

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

#1310183

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 ?

#1310491

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'
    });
});
#1311281

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.

#1311387

Ok great!