We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

JavaScript Calendar Popup

Medium Priority
1,031 Views
Last Modified: 2013-11-19
Hi,

I have been working on a event form for a colleague of mine that the company I work for will be hosting.  I have managed with the assistance of experts here at expert-exchange to get the form working with a fair bit of JavaScript, however I have noticed a slight issue with some script I found on the Internet which provides a JavaScript popup calendar which opens in a div.  The calendar works fine and looks great and does exactly what I want it to do.

The problem is one of my fields is date of birth and the calendar only starts from 2007 and ends at 2011.  I have looked at the JavaScript and found some reference to the start year offset and changes it from 2 to 120.  The issue with this is it displays 120 years  + and - of the current year.  This is no good for me all I wanted it to do is go back 120 years and remain 2 years + of the current year.

I have uploaded the JavaScript file and was wondering if there is anything I missing.  I would really appreciate any assistance with this as it's the last little issue I have.
CalendarPopup.js.txt
Comment
Watch Question

Software Engineer
Commented:
If you want that functionality in that attached javascript file, please change line #1289
which contains:

for( var yearCounter=year-this.yearSelectStartOffset; yearCounter<=year+this.yearSelectStartOffset; yearCounter++ ) {

to

for( var yearCounter=year-this.yearSelectStartOffset; yearCounter<=year; yearCounter++ ) {

and it will only show the years from the current year until the current year minus the offset.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Nice one, it works - thank you so much, I have been looking at this JS code for days trying to find where it applied the yearCounter.  My knowledge of JavaScript is very limited but is growing all the time thanks to you and the other experts here that keep helping.  So again many thanks for your help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.