Discussions

 View Only
  • 1.  Prevent future dates

    Posted 03-08-2017 14:32
    Can I prevent future dates in a date field? I need to only allow the user to select the current day or before.


  • 2.  RE: Prevent future dates

    Posted 03-08-2017 14:47
    You can use a form rule to prevent the record from being saved if the date is after the current date (see image below).

    Adding a form rule that will change the date to the current date if the user tries to set it for a future date works sometimes but not every time. The rule to prevent it from being saved is the better way.

    Note that this won't prevent users from entering a future date using grid edit, another form, or the API.

    Depending on your use case, you could also create a second date field - a formula date field - to make sure the date is never later than the current date. Users could enter any date they want in the first date field, using any form, grid edit, or the API - and the value of the formula  date field would either be the date chosen by the user or the date the record was created, whichever is earlier.

    Phillip Dennis



  • 3.  RE: Prevent future dates

    Posted 03-08-2017 17:59
    QuickBase uses the jQueryUI datepicker and the datepicker can be configured through script to allow or disallow dates that meet certain criteria.

    See these pasties and links to old forum posts and demos:

    Formula for date field to display only first day of each week?
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=257

    Can I use a date - formula field to force users to input only the current date or a past one, no future date
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=447

    Is there a way to only allow certain dates to be selected in a date field
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=513


  • 4.  RE: Prevent future dates

    Posted 07-06-2018 14:14
    Hey Dan, if I wanted to force users to input only the current date or a future date, no past date, would I change the "maxDate" here to "minDate"? 

    $("#_fid_6").datepicker("option", {
      maxDate: "0"
    });


  • 5.  RE: Prevent future dates



  • 6.  RE: Prevent future dates

    Posted 07-06-2018 14:57
    Awesome, thanks for the link