Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have found your site brilliant. What makes it good are the people that contribute to the site..."

Geography

Where in the world do Tek-Tips members come from?
jgcalifornia (Programmer)
29 Mar 12 12:34
Having a problem with the calendar on these pages:

http://www.harmonyhall.com/Cottages/Jamaica/ja-seasiderates.php
http://www.harmonyhall.com./Cottages/CostaRica/lacasita-rates.php

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  ;)
feherke (Programmer)
29 Mar 12 12:49
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 :
  • reserving for a past interval ( 2012-01-01 .. 2012-01-03 )
  • reserving for a invalid interval ( 2012-02-30 .. 2012-02-31 )
  • reserving for a wrong interval ( 2012-04-30 .. 2012-04-01 )

Feherke.
http://feherke.github.com/

jgcalifornia (Programmer)
29 Mar 12 12:58
you cannot find such code for what?
Im sorry i dont really get what your saying.
feherke (Programmer)
29 Mar 12 13:10
Hi

Quote (jgcalifornia):

you cannot find such code for what?
JavaScript form validation.

Feherke.
http://feherke.github.com/

jgcalifornia (Programmer)
29 Mar 12 13:29
i didnt use validation
vacunita (Programmer)
29 Mar 12 13:52
Lets take it a step at a time.

  1. Your Calendars appear to be merely cosmetic, with no real relation to the date selection drop downs.
  2. With no form validation there's no way to limit what dates can be selected and reserved
  3. As feherke points out PHP my be catching some dates problems but not all of them, and some will say its occupied
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.

Quote:


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
 

jgcalifornia (Programmer)
29 Mar 12 14:00
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!
vacunita (Programmer)
29 Mar 12 18:20
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.

Quote:

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
 

jgcalifornia (Programmer)
29 Mar 12 20:05
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.  
vacunita (Programmer)
29 Mar 12 20:24
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
 

jgcalifornia (Programmer)
29 Mar 12 20:29
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?
vacunita (Programmer)
29 Mar 12 20:36

Quote:


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 {
    color: #ccc;   
/*    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
 

jgcalifornia (Programmer)
31 Mar 12 10:36
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?
vacunita (Programmer)
1 Apr 12 16:34

Quote:


what purpose these provide to the user.

Visual Indication of available dates I guess.


Quote:


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.


Quote:


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
 

jgcalifornia (Programmer)
1 Apr 12 18:15
OK.  
Thank you everybody for explaining and being patient with me.
Appreciate all of your help and input.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close