Is there a way to only allow certain dates to be selected in a date field

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

If Field 1 or Field 2 are populated with a date then you can select any date

if Field 1 or Field 2 are not populated you will have to wait two days from the current date (so today and tomorrow dates are not available) 

Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
QuickBase uses the jQueryUI library for its datepicker:

jQueryUI Datepicker
https://jqueryui.com/datepicker/


This datepicker widget has a large number of configuration options which can be controlled through <script>. For example, including or excluding holidays, weekends or other business logic can be implemented to control which dates are available for selection. This example hardcodes a set of four available dates that can be selected:

  var availableDates = ["6/21/2016", "6/23/2016", "6/25/2016", "6/26/2016"];


Restrict Available Dates ~ Add New Record
https://haversineconsulting.quickbase.com/db/bkx488cmw?a=nwr

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=513

You specific need to examine two fields and dynamically alter the available dates can be achieved with some simple modifications to my example. Feel free to contact me if you need additional help.
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
How do I install the jQueryUI Datepicker, do I just put the Restrict Available dates code in a date field?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
QuickBase uses jQuery and jQueryUI so these libraries area already loaded on the page. Was that what you are asking?
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
Using this code below, how do I write if Field 1 is null then use
 var minDate = $(this).datepicker("option", "minDate");
    $("#_fid_97").datepicker("option","minDate", "+2d");
if Field 1 contains a date then any date is available
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
writing a conditional formula using jqueryui.
Photo of Shontay

Shontay

  • 490 Points 250 badge 2x thumb
Can you use this formula for grid edit