Re: Set minimum date in calendar on form

Jo_Pitts1
Level 10 - Community Advisor

Set minimum date in calendar on form

All,

has anyone found a way to set a minimum date for the date picker field on a Marketo form.

 

Ideally, I don't want a prospect to be able to select a date within 2 days of the current date. (i.e. today is the 30th of June, 2022.  I don't want people to be able to choose any date earlier than the 2nd of July, 2022).

 

Cheers

Jo

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Set minimum date in calendar on form

Not using the default calendar but by plugging in, say, Kalendae:

MktoForms2 :: Kalendae enhanced calendar - Demo 02

Jo_Pitts1
Level 10 - Community Advisor

Re: Set minimum date in calendar on form

@SanfordWhiteman ,

something isn't quite right with that example:

  1. It doesn't put a date into the field after selecting from the calendar widget.
  2. If you try to change months, the Kalendae popup vanishes.

Thoughts?

 

Cheers

Jo

SanfordWhiteman
Level 10 - Community Moderator

Re: Set minimum date in calendar on form

Hmm, lemme debug that, it's an old demo.

Jo_Pitts1
Level 10 - Community Advisor

Re: Set minimum date in calendar on form

Much appreciated.

I've managed to get the blackout part working... just need your epic skills on those issues 🙂

Jo_Pitts1
Level 10 - Community Advisor

Re: Set minimum date in calendar on form

@SanfordWhiteman ,

it seems Kalendae is a bit broken.  Their own examples are exhibiting the same problems that I saw in your demo.

 

However, I took the core logic from your demo (namely declaring the field as text not date in the form, and then binding a JS date picker to the input), and used https://flatpickr.js.org/ instead.

 

Now, is it worth the effort to put in a nicer date format, and then reformat it back to something that Marketo understands on submit.... Hmmmm

Jo_Pitts1
Level 10 - Community Advisor

Re: Set minimum date in calendar on form


@Jo_Pitts1 wrote:

Now, is it worth the effort to put in a nicer date format, and then reformat it back to something that Marketo understands on submit.... Hmmmm


So, I did that.  It works very nicely.  The input field displays dd-MMM-yyyy format, and on submit converts it back to yyyy-mm-dd.

 

Thanks for pointing me in the right direction @SanfordWhiteman.