Tell us what you are trying to do?
I'm trying to create a form with three dates, with a condition : the second date should be after the first one and before the third one, and the datepickers should not allow to select a "wrong" date.
Is there any documentation that you are following ?
I am using the recipe in this support forum thread (adapted to the fact that I have three dates, not two) :
https://toolset.com/forums/topic/this-field-is-required-error-but-field-is-filled-out/
It is supposed to solve my exact "fields not saving" problem, but it does not work. I can't understand what is the issue.
Here is my complete JS code for that form :
///First function, not related to the question
jQuery(document).ready(function($) {
setTimeout(function() {
if($( "input.js-wpt-date" )) {
$("input.js-wpt-date").each(function() {
val = $(this).val();
$(this).datepicker("option", "yearRange", "-3:+5");
$(this).datepicker("option", "numberOfMonths", 3);
$(this).val(val);
});
}
}, 500 );
}) ;
/// INTERESTING THINGS START HERE
jQuery(document).ready(function() {
var fromId = jQuery('input[name="wpcf-date-de-mise-en-production[display-only]"').attr('id');
var intId = jQuery('input[name="wpcf-date-de-fin-de-tournage[display-only]"').attr('id');
var toId = jQuery('input[name="wpcf-date-de-fin-de-post-production[display-only]"').attr('id');
var $from = jQuery( '#' + fromId );
var $int = jQuery( '#' + intId );
var $to = jQuery( '#' + toId );
var alt_filed_from = jQuery('input[name="wpcf-date-de-mise-en-production[datepicker]"').attr('id');
var alt_filed_int = jQuery('input[name="wpcf-date-de-fin-de-tournage[datepicker]"').attr('id');
var alt_filed_to = jQuery('input[name="wpcf-date-de-fin-de-post-production[datepicker]"').attr('id');
$from.datepicker('option', 'dateFormat', 'd MM yy' );
$from.datepicker('option', 'minDate',0);
$from.datepicker('option', 'onSelect', function( selectedDate, obj ) {
if(selectedDate) {
var sd = selectedDate.split("/");
stamp = new Date(Date.UTC(sd[2], sd[1]-1, sd[0])).getTime();
stamp = parseInt(stamp/1000);
jQuery('#'+alt_filed_from).val(stamp);
$int.datepicker( "option", "minDate", selectedDate );
}
});
$int.datepicker('option', 'dateFormat', 'd MM yy' );
$int.datepicker('option', 'onSelect', function( selectedDate, obj ) {
if(selectedDate) {
var sd = selectedDate.split("/");
stamp = new Date(Date.UTC(sd[2], sd[1]-1, sd[0])).getTime();
stamp = parseInt(stamp/1000);
jQuery('#'+alt_filed_int).val(stamp);
$int.datepicker( "option", "maxDate", selectedDate );
$to.datepicker( "option", "minDate", selectedDate );
}
});
$to.datepicker('option', 'dateFormat', 'd MM yy' );
$to.datepicker('option', 'onSelect', function( selectedDate, obj ) {
if(selectedDate) {
var sd = selectedDate.split("/");
var newDate = sd[1]+"/"+sd[0]+"/"+sd[2];
stamp = new Date(Date.UTC(sd[2], sd[1]-1, sd[0])).getTime();
stamp = parseInt(stamp/1000);
jQuery('#'+alt_filed_to).val(stamp);
$int.datepicker( "option", "maxDate", selectedDate );
}
});
});
Is there a similar example that we can see?
What is the link to your site?
declarations.cchscinema.org (password : reaumur). But I have deactivated the code that creates problems, since the client is testing the website at the moment.