Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript error/calendar

Status
Not open for further replies.

jgcalifornia

Programmer
Mar 29, 2012
8
0
0
JM
Having a problem with the calendar on these pages:


It allows you to make a reservation putting in dates that are greyed out and marked as unavailable, cannot figure out why.

Also getting an error in IE9
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
although the path to these images is correct.

I am very new to JS, please go easy on me, i appreciate any help!
thank you ;)
 
Hi

Are you sure there is JavaScript validation too ? I can not find such code.

By the way, reserving for an occupied interval is at least caught by PHP. But there are situations which neither the PHP catches :
[ul]
[li]reserving for a past interval ( 2012-01-01 .. 2012-01-03 )[/li]
[li]reserving for a invalid interval ( 2012-02-30 .. 2012-02-31 )[/li]
[li]reserving for a wrong interval ( 2012-04-30 .. 2012-04-01 )[/li]
[/ul]


Feherke.
 
you cannot find such code for what?
Im sorry i dont really get what your saying.
 
Lets take it a step at a time.

[ol]
[li] Your Calendars appear to be merely cosmetic, with no real relation to the date selection drop downs.[/li]
[li]With no form validation there's no way to limit what dates can be selected and reserved[/li]
[li]As feherke points out PHP my be catching some dates problems but not all of them, and some will say its occupied[/li][/ol]

With that said, while you can use Javascript to disable certain dates from the drop downs, major date validation should be done in PHP to be absolutely sure the dates are correct, and there is vacancy in those dates.

It allows you to make a reservation putting in dates that are greyed out and marked as unavailable, cannot figure out why.

There is no validation preventing such a selection.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
so your saying the calendars are useless, and there is nothing in the js that is making them function properly?
So do i need to find the problem (or solution) to the php page, or the js ?
thank you for explaining!
 
The Calendars are decorative. They have no other use, nor do they affect the drop downs in any way. There's nothing in the JS that even remotely references the calendars.

That is the Calendars are just straight up HTML generated by PHP.
Static.

So do i need to find the problem (or solution) to the php page, or the js ?
Both. While the validation can be done in JS, PHP should also validate as JS can be easily turned off, or circumvented.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
So the days on the calendar that are grayed out, which do coincide with the schedule, how are those displayed properly?
Im sorry I dont quite get it..I'm helping out a friend, who's old web guy is no longer, which is whom created this site.
So I have what he left me, im trying to get a sense of it all, but i do know that my friend said the calendars do not function anymore, we are just trying to figure out why.
there is a 'js' folder in the root which contains a calendar.js. Not sure why its not being referenced, or how it worked before.
 
There is no calendar.js being called in the pages you linked to.

I don't know what the calendar.js does though so can't say that adding a script include for the js file will make them work.

The Calendars are set by PHP, the grayed out dates are simply set by giving the specified days a class of occupied. That is a simple If in the PHP portion, that checks whether date is after the current date or not and if they are occupied.

PHP and Javascript are completely independent of each other.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Hello, yes i get that they are totally independent. He obviously did those pages in PHP for a reason though, because only the reservations pages and the artists page are done in php, the rest are htm...
So the class of occupied that the gray ones have, how did they become gray, i mean, noone has set them to occupied.
thank you again, for explaining!
Can i post the calendar js here?
 
So the class of occupied that the gray ones have, how did they become gray, i mean, noone has set them to occupied.

I don't know what your PHP is doing, so I can't say for sure. I'm assuming it uses the same class for occupied dates as well as past dates when it creates the calendar.

The css class is what makes the days look gray:
Code:
table.calendar  td.occupied {
[red]	color: #ccc;   [/red]
/*	background-color: #2e5f5c;
	background-color: #84667E;
*/}

And PHP I assume sets the class of the specific dates to occupied so they are given the gray color.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
If this is the case, i guess my next question would be what purpose these provide to the user.
Is there a "working" calendar i should replace with this one?
Do you need a PHP page for w working calendar?
 
what purpose these provide to the user.

Visual Indication of available dates I guess.


Is there a "working" calendar i should replace with this one?

I'm sure there are many calendars out there, that have the functionality to limit certain dates from being selected.


Do you need a PHP page for w working calendar?
Not necessarily. Though if the occupied and/or valid dates are being pulled from a Database, then yes you'll need PHP to pull the dates and somehow talk to the JS calendar to have it disable those dates.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
OK.
Thank you everybody for explaining and being patient with me.
Appreciate all of your help and input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top