You are viewing limited content. For full access, please sign in.

Question

Question

Restricted Calendar Choices

asked on October 5, 2014

I have a "Time Sheets" form that uses the Date fields to choose week ending (twice in each submission).  My client is afraid that her employees will not know or remember that the week always ends on Saturday.  Is there is any way to restrict the pop up Calendar to only allow Saturday options?

Thanks for any ideas!

0 0

Replies

replied on October 6, 2014

I do not know of any way that you can restrict the date like that. We really can only restrict the minimum and maximum dates one can input into those fields.

 

What you might need to do is take the value of the date field, and run a little function to determine how far off it is from the end of the week, and then replace the value in that field with the date of the next closest end of week, and display to the user that the date has been adjusted to the proper end of week based off their original input.

0 0
replied on October 6, 2014

The way I would do this is to create a database table that has all the days of the year in the first column, and in the second column, the next available end of week. 

 

What you do is make a hidden field as the lookup field, or a "Date of work" field for the user to input into. If you use a hidden field, you copy the value from the current field to the hidden field and trigger the lookup like this: (apply CSS Class Name LookupVar to the visible field, and LookupField to the hidden field.)

 

$(function() {
  $(document).ready(function () {
      function triggerLookup() {
          var fieldValue = $('.LookupVar input').val();
          $('.LookupField input').val(fieldValue);
          $('.LookupField input').trigger('change');
    }
  $('.LookupVar').on('change','input',triggerLookup);
}

 

If you do it the other way with two visible fields, then you do not need to use any Javascript at all.

1 0
replied on October 6, 2014 Show version history

I know for the jQuery UI 1.9.2 library the following code works, but it does not seem to be working in LF Forms. Maybe we can get someone to help out to convert this.

$("#q7").hasdatepicker({
    beforeShowDay: function(date){ return [date.getDay() == 6,""]}
});

 

2 0
replied on October 6, 2014

I thought it was a long shot at best.  Thanks for your effort.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.