FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable calendar in Date field (adding validation) or modify date range for pop up
#1
We are looking to use a date field that submitters will normally be entering between 50-75 years from the current date. Since the calendar pop up does not have a "scroll" for year I would like to either disable the calendar and keep a date field (and force submitters to use a mm/dd/yyyy format and validate on that format), or at the very least change the default value for the calendar to 50 years prior to current date.

I noticed there are many "options" for date-range in the daterangepicker.jquery.js, but I have no idea how to enable a different date range than the current date or 'today' for the calendar on a date field.

Is there an obvious or easy way to do this that I just haven't noticed?




Reply
#2
For my purpose, I was able to modify the formtools/mysite/themes/default/scripts/jquery-ui-1.8.6.custom.min.js

Looking at the jquery documentation for this widget, I was able to modify the default range for the year pulldown.
Default is yearRange:"c-10:c+10"
I changed it to yearRange:"c-100:c"

If dealing with birth dates, I would suggest c-125:c since we continue to live longer. I think the oldest individual is 120? Anyway, this solves my problem. Just wanted people to know what to modify for increasing the year range in the calendar.

One final note: Avoid using a negative number after the : for this variable. The Max expects to be at least the current date, if you use a negative year for the max, the calendar comes up with bad data.
Reply
#3
John,

Thanks for posting your solution.

Cheers,

Joe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)