Custom date selection validation within a date picker field type | Community
Skip to main content
November 30, 2015
Question

Custom date selection validation within a date picker field type

  • November 30, 2015
  • 1 reply
  • 1727 views

Is there a way to customise the dates that are available to be selected from the Date Picker field type within a form?

For example, can it be set to allow business day selections only? Or invalidate the selection of older dates? Or invalidate dates within a range?

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

March 22, 2016

Hi Michael,

I've made a work around with this custom available dates for selection, turns out that Marketo is using the jQuery UI datepicker element, so you can add extra things using it's API.

http://api.jqueryui.com/datepicker/

The trick is adding custom JS code in the landing page for altering the datepicker properties, for example I used the following code:

MktoForms2.$('.mktoDateField').datepicker( "option", "maxDate", new Date('2016-12-01'));

MktoForms2.$('.mktoDateField').datepicker( "option", "minDate", new Date('2016-12-12'));

hope it helps.