Classic dffs – block out dates on date field calendar

Forums Classic DFFS Classic dffs – block out dates on date field calendar

Viewing 2 reply threads
  • Author
    • #37422

      Hi Alex,

      Hoping you can help me with a solution. I would like to block out dates available to be chosen from a date field calendar. For instance a due date field I would like the use to not be able to choose anything within 5 days or even business days if possible.. any suggestions? I have not had any luck searching for this type of solution.

      Thank you

    • #37423
      Alexander Bautz

      There is unfortunately no function to block the selection of the dates, but you can run a validation after the user has picked the date by adding some custom js and a rule.

      Add this to your custom js:

      function validateDateField() {
          var dateFieldInternalName = "DateColumn1";
          var today = new Date();
          var date = spjs.utility.getDateFieldAsDateObject(dateFieldInternalName);
          var requiredDateOffset = 6;
          var diffDays = (date - today) / (24*60*60*1000);
          if (diffDays < requiredDateOffset) {
              jQuery("#dffs_"+dateFieldInternalName+"").append("<div class='customDateValidation' style='color:red;'>The date must be atleast <strong>"+requiredDateOffset+"</strong> in the future.</div>");
              jQuery("#dffs_"+dateFieldInternalName+" input").val("");

      Change “DateColumn1” to match your date field internal name.

      Now add a rule that triggers on “is changed” on your date field and add the name of the function to the “Run these functions / evaluate these rules” field like this:


      When a selection is made in the field, this code checks if the value selected is 6 days in the future and shows a message and clears the value if it is not at least 6 days ahead.


      • This reply was modified 4 weeks, 1 day ago by Alexander Bautz. Reason: Fixed code snippet format
    • #37425

      Thank you Alex!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.