flatpickr icon indicating copy to clipboard operation
flatpickr copied to clipboard

An invalid form control with name='' is not focusable

Open idem84 opened this issue 2 years ago • 5 comments

image

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

idem84 avatar Jul 05 '23 14:07 idem84

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.

Murielle666 avatar Jul 07 '23 10:07 Murielle666

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

sftl avatar Aug 28 '23 12:08 sftl

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,
        });

Grafikart avatar Oct 12 '23 13:10 Grafikart

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

sftl avatar Dec 18 '23 11:12 sftl