Forums

Forums / Developing Portals / Date field - Validation

Date field - Validation

Thread is closed for posting
2 posts, 1 answered
  1. Krishna Hari
    Krishna Hari avatar
    65 posts
    Registered:
    05 Dec 2019
    07 Jan 2020
    Link to this post
    I have a date field which should only accept today or past
    also  another field to not accept anything in the past.
    Is there a way to configure it?
  2. Alex
    Alex avatar
    19 posts
    Registered:
    27 Sep 2018
    Answered
    08 Jan 2020 in reply to Krishna Hari
    Link to this post
    Hello Krishna, 
    There definitely is a way to accomplish this. All that is required is that you add some custom JavaScript
    Your first question would be answered by setting your maxDate to today, you would do that by doing something like this in javascript "FieldName.maxDate = new Date(new Date().setHours(0,0,0,0));"
    Your Second question would be answered by setting your minDate to today, you would do that by doing something like this in javascript "FieldName.minDate = new Date(new Date().setHours(0,0,0,0));"
    Hope this helped.
2 posts, 1 answered