Skip to content

Range select with two fields

Cliff Parnitzky edited this page Feb 15, 2023 · 1 revision

To have a a range selection with two fields that are linked follow this instruction:

  • create both formfields
  • enter the following code at the first formfield for 'Custom configuration' and replace <ID_FF2> with the Contao record id of the second formfield
onChange: function(selectedDates, dateStr, instance) {
  picker_<ID_FF2>.set('minDate', selectedDates[0].fp_incr(1));
}
  • remove .fp_incr(1) if the selectable date for the second formfield should be the same of the first formfield
  • replace the 1 in .fp_incr(1) with another number to define the minimal selectable date for the second formfield after the seleted date of the first formfield
Clone this wiki locally