jQuery('input.hasDatepicker').datepicker('option','onSelect',function(){
var formattedDate = jQuery.datepicker.formatDate('DD', jQuery('input.hasDatepicker').datepicker('getDate'));
var selDateValue = jQuery.datepicker.formatDate('MM, dd yy', jQuery('input.hasDatepicker').datepicker('getDate'));
jQuery('input.hasDatepicker').datepicker( 'option', 'dateFormat', 'MM, dd yy' );
jQuery('input.hasDatepicker').datepicker( 'setDate', selDateValue );
jQuery('input.hasDatepicker').val(selDateValue );
jQuery('input.hasDatepicker').parent().parent().addClass('activedate');
console.log(formattedDate,selDateValue);
});
i want on change of the datepicker to see the date in jquery so if is a specific day to change some other values.
with this code when am submiting the form it says error this field is required but it has a visible value
Hi there,
I am not sure if I understood the purpose of the jQuery code.
If you can explain more I might be able to understand the requirement
Also please provide the link to the page that contains the datepicker so I can do some tests,
If there is a need to be logged in to see the datepicker please make sure the next replay is marked as private and provide the login info.
Thanks.
If user choose date on the datepicker and is wednesday i want a js function to run so i can change the available hours. Am using toolset forms date field.
Hi there,
I am not sure why it might not work. Toolset uses jQuery UI Dtaepicker so the standard code is used. You need to check your jQuery code.
i can take a look into the page but I asked for the link but you did not provide one. i might be able to check it on my browser and find a clue.
Thanks.
Hello, i have duplicated the site so i can send you credentials. Can you make the next reply private?
Sure here you go, you will have the checkbox now to set the next reply as private.
Thanks.
Hi there I tried many methods but unfortunately, it is not working. This is indeed a custom development thing that is outside of our support scope.
What I have in mind is that it might be a restriction imposed by the browser that it will prevent changing another item of HTML when a trigger happens by another HTML.
The reason I say that is I tested the code below:
jQuery(document).ready(function($) {
// Adding a button to manually trigger the hour change
$('body').append('<button id="setHourButton">Set Hour to 10</button>');
// Bind click event to the new button
$('#setHourButton').on('click', function() {
$('#cred_form_94_1_1_choose-preferred-datehour').val('10').trigger('change');
console.log("Hour set manually to:", $('#cred_form_94_1_1_choose-preferred-datehour').val());
});
});
That code adds a button to change the HOUR select to 10 instead of 8 and it works. But same thing does not work when using the datepicker onSelect trigger.
Thanks.