• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Highlighting Date Range in jQuery Calendar

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone! I'm new to the forum, it's great to meet you all.

I have a question and I'd really appreciate some guidance.

I am having some trouble with Javascript on one of my jsp files. Since I'm new, I'm not sure if this is the right section for this post. Please forgive me if i've made a mistake.

I'm using a JQuery datepicker 1.7 as a calendar on the sidebar on the user's view. (It's the best option I could find)

I would like to highlight in the calendar a group of days starting from initial date (startDate) until the end (endDate) of several reminders I have in an array. This way, the user will be able to see on the calendar of the application, all the available days he has left in order to take action for each of his reminders.

I already have my array of reminders which I can access from the view.

This is my javascript function for the datepicker:


There is another function, namely, highlightDays which is the one that is causing me trouble:

It's parameter is the array "reminders" such that reminders[i].start is the startDate, and reminders[i].end is the endDate of reminder i, with i = number of reminders in the array.



The problem is the calendar won't even show up when I open the application and log in. And the Apache Log or output do not show any errors. I will keep investigating, but I'd really appreciate some guidance!

P.D: I can access the elements of the array of reminders (endDate, startDate) and print these dates on screen, so that means the reminders array is not empty.

Do you think the problem might be i'm not using the appropriate input parameter for the highlightDays function? If so, parameter do you think I should use? Is there another javascript function that makes this easier? I haven't found one yet but would very much appreciate it if you know any.

Thank you once again for taking the time to read, and sorry for the long post.
 
Sheriff
Posts: 67553
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andres Cordova wrote: the Apache Log or output do not show any errors


That's not where JavaScript errors will show up. Enable the JavaScript console for whatever browser you are using.
 
Andres Cordova
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah! that's right, I should have mentioned, I am using NetBeans IDE and my browser is Google Chrome. I'll activate the javascript console and look for the errors, thanks! Oh...you happen to have written books on JQuery! Interesting, that could prove very useful from what i'm doing, I'll get the 2nd edition of JQuery in Action
 
Andres Cordova
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, so the Javascript console says:

Uncaught TypeError: Cannot read property '0' of undefined
http://localhost:8084/CPYD/interfaz/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png Failed to load resource: the server responded with a status of 404 (Not Found)

Hmmmm....I might not be accessing the reminders properly....I'll keep investigating, and post anything new I come up with.

Thanks a lot for the help so far!
 
Andres Cordova
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After lots of research, I did some changes to the function, like this:

This is my selector:



and then highlightDays function would be



So, highlightDays receives a parameter date, which represents all dates of the calendar. I'm trying to tell the highlightDays function here that if that day is within the range, it should be highlighted. The Javascript console shows no errors, but it only highlights the actual day and not the ranges in the reminders array.

Will let you guys know of any further advancements!!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic