flatpickr
flatpickr copied to clipboard
An invalid form control with name='' is not focusable
Got this error with this settings:
flatpickr(".datetimepicker1", {
locale: Russian,
enableTime: true,
dateFormat: "d.m.y H:i",
static: true,
minDate: Date.now(),
});
I have datetime input inside bootstrap modal window, in dialog box if dont change time i have this error on form submit.
Video: https://skr.sh/vKfi7OGzCDg?a
We were having the same problem, but were able to fix the problem after removing the static: true.
However, this might cause problems on mobile layout.
flatpickr v4.6.9 Device: iPhone
Same here, It happens in iPhone devices, but it works correctly for Xiaomi and other devices. Also the input which is failing is not required, has the class 'flatpickr-mobile' and type 'datetime-local', if I delete this input manually from the DOM the form can be submitted
Thank you for this great tool. Cheers
I was having the same issue and you have to be carefull about the "minuteIncrement" option. By default this option is set to 5 so if you have a time with a minute that is not a factor of 5 it creates the error you just got.
// This should fix the issue
flatpickr(".datetimepicker1", {
locale: Russian,
enableTime: true,
dateFormat: "d.m.y H:i",
static: true,
minDate: Date.now(),
minuteIncrement: 1,
});
I was having the same issue and you have to be carefull about the "minuteIncrement" option. By default this option is set to 5 so if you have a time with a minute that is not a factor of 5 it creates the error you just got.
// This should fix the issue flatpickr(".datetimepicker1", { locale: Russian, enableTime: true, dateFormat: "d.m.y H:i", static: true, minDate: Date.now(), minuteIncrement: 1, });
HI @Grafikart ,
Thank you for your answer. So, how can I config the plugin to work with minuteIncrement: 1? I really need it works this way. And, why is it failing ONLY in IPhone devices? I have tested in some other mobile brands and it works properly. Finally, I think 1 is a factor of 5.
{
enableTime: true,
enableSeconds: true,
time_24hr: true,
dateFormat: "Y-m-d H:i:S",
minuteIncrement: 1,
defaultHour: date.getHours(),
defaultMinute: date.getMinutes(),
defaultSeconds: date.getSeconds(),
locale: {
firstDayOfWeek: 1,
},
wrap: true,
allowInput: true,
clickOpens: false,
}
Cheers