How to create a future-only date field | Community
Skip to main content
Kelly_Bakalich
Level 1
February 3, 2020
Solved

How to create a future-only date field

  • February 3, 2020
  • 1 reply
  • 2010 views

I'm creating a form for students to fill out that includes their graduation date. I need the "date of graduation" field to have a default value of "today", and cannot select a past date.

 

Can someone help me figure out how to do this?

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

The key is to use a Text field (not Date) and then mark it up using a JS datepicker library that supports min/max cross-browser (there's no native support for this that works in all browsers). Search my past posts for "Kalendae", it's been discussed before w/examples.


EDIT: In Kalendae your options object would be

 

{ format: "YYYY-MM-DD", diretion: "future", selected: Kalendae.moment() }

 

That sets the format (obviously), the direction to be future-only, and the default to be today.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
February 3, 2020

The key is to use a Text field (not Date) and then mark it up using a JS datepicker library that supports min/max cross-browser (there's no native support for this that works in all browsers). Search my past posts for "Kalendae", it's been discussed before w/examples.


EDIT: In Kalendae your options object would be

 

{ format: "YYYY-MM-DD", diretion: "future", selected: Kalendae.moment() }

 

That sets the format (obviously), the direction to be future-only, and the default to be today.

SanfordWhiteman
Level 10
February 4, 2020

@kelly_bakalich did you see this response?