a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Way to block off dates in booking system

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Way to block off dates in booking system
Page: [1]
 
raksha

 

Posts: 92
Joined: 3/6/2003
Status: offline

 
Way to block off dates in booking system - 2/22/2007 16:01:42   
Is there a way in this code to block of all entries prior to March 19, 2007.. I want the user to get a "Sorry not avilable until the 19th"
The code I thought would work I bolded...
They have entered the dates in the previous form..
Hope this makes sense.. This is not something I'm really understanding so not sure what to do...
:)
<% 
Dim conntemp, myDSN, myRS, mySQL, arrCampSite, varDateStart, varDateEnd 
varDateStart = Request.Form("DateStart") 
varDateEnd = Request.Form("DateEnd") 
Set conntemp=Server.CreateObject("ADODB.Connection") 
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../fpdb/index.mdb") 
conntemp.open myDSN 
mySQL = "SELECT CampSite FROM PEACEHAVEN3A WHERE ((#"&varDateStart&"# Between DateStart And DateEnd) OR (#"&varDateEnd&"# Between DateStart And DateEnd))"
Set myRS = Server.CreateObject("ADODB.Recordset") 
myRS.Open mySQL, conntemp, 0, 1
If myRS.eof OR myRS.bof then 
RecordFound=0 
Else 
arrCampSite = myRS.GetString(,,,"<br>") 
RecordFound=-1 
End if 
myRS.Close 
Set myRS = nothing 
conntemp.Close 
Set conntemp = nothing 
%> 
<html>

<head>
<script language='javascript'>
<!-- //
function setReadOnly(obj)
{
if(obj.value == "NO")
{
document.forms[0].OTHER.style.backgroundColor = "#ffffff";document.forms[0].CAMPGROUP.style.backgroundColor = "#EEEEEE"; document.forms[0].SECTION.style.backgroundColor = "#eeeeee";document.forms[0].TypeOfUse.style.backgroundColor = "#ffffff";
document.forms[0].OTHER.readOnly = 0;document.forms[0].CAMPGROUP.readOnly = 1;document.forms[0].SECTION.readOnly = 1;document.forms[0].TypeOfUse.readOnly = 0;
document.forms[0].OTHER.value = "";document.forms[0].CAMPGROUP.value = "";document.forms[0].SECTION.value = "";document.forms[0].TypeOfUse.value = "";

} else {
document.forms[0].OTHER.style.backgroundColor = "#eeeeee";document.forms[0].CAMPGROUP.style.backgroundColor = "#ffffff";document.forms[0].SECTION.style.backgroundColor = "#ffffff";document.forms[0].TypeOfUse.style.backgroundColor = "#B3B3B3";
document.forms[0].OTHER.readOnly = 1;document.forms[0].CAMPGROUP.readOnly = 0;document.forms[0].SECTION.readOnly = 0;document.forms[0].TypeOfUse.readOnly = 1;
document.forms[0].OTHER.value = "";document.forms[0].CAMPGROUP.value = "";document.forms[0].SECTION.value = "";document.forms[0].TypeOfUse.value = "";


} 

}
// -->
</script>


<script>
var allBoxes = ["CampSite1", "CampSite2", "CampSite3", "CampSite4", "CampSite5", "CampSite6", "CampSite7", "CampSite8", "CampSite9", "CampSite10", "CampSite11", "CampSite12", "CampSite13", "CampSite14", "CampSite15", "CampSite16", "CampSite17"];
function checkAll(theBox){
  theForm = theBox.form;
  for(i=0;i<allBoxes.length;i++){
    theForm[allBoxes].checked = theBox.checked;
  }
  theSpan = document.getElementById('unCheck');
  if(theBox.checked==true){
    theSpan.innerHTML = "Uncheck";
  } else {
    theSpan.innerHTML = "Check";
  }
}
</script>
 

<script type="text/javascript" language="JavaScript">
<!--
function checkcheckboxes(form) {
if (
form.CampSite1.checked == false &&
form.CampSite2.checked == false &&
form.CampSite3.checked == false &&
form.CampSite4.checked == false &&
form.CampSite5.checked == false &&
form.CampSite6.checked == false &&
form.CampSite7.checked == false &&
form.CampSite8.checked == false &&
form.CampSite9.checked == false &&
form.CampSite10.checked == false &&
form.CampSite11.checked == false &&
form.CampSite12.checked == false &&
form.CampSite13.checked == false &&
form.CampSite14.checked == false &&
form.CampSite15.checked == false &&
form.CampSite16.checked == false &&
form.CampSite17.checked == false)
{
alert ('Choose at least one checkbox, please.');
return false;
} else {
return true;
}
}
//-->
</script> 


<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>PEACEHAVEN</title>
<meta name="Microsoft Theme" content="blends 0011">
</head>

<body> 
<p>
<% 
If RecordFound <> 0 then 
Response.Write ("") 
else 
Response.Write(arrCampSite) 
End if 
%> 
<%
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
end if
%></p>
 <form method="POST" name="FrontPage_Form1" action="4InsertQuerypeace.asp" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript">
<input type="hidden" name="DateStamp" size="20" value="<%=Now()%>">
   <div align="left"> 
                  <font size="4">PEACEHAVEN<br>
</font></div>
   <div align="left"> 
                  <font size="1">
                  <input type="text" name="DateStart1" size="20" value="<%=varDateStart%>" disabled> 
                  (to change these dates click the back button on your browser)</div>
<input type="text" name="DateEnd1" size="20" value="<%=varDateEnd%>" disabled> <br>
   <br>
   <input type=checkbox name="CheckAll" onClick="checkAll(this)" value="ON"><span id="unCheck">Check</span> All 
   (books the whole camp)<br>
   <br>

   <input type="checkbox" name="CampSite1" value="Kuffufle" <%If Instr(arrCampSite,"Kuffufle") Then Response.Write("disabled")End IF%>> </font>Kuffufle<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite2" value="Kincenter" <%If Instr(arrCampSite,"Kincenter") Then Response.Write("disabled")End IF%>>Kincenter<span lang="en-us"><br>
   <br>SORRY - NOT AVAILABLE
      Lions 
   Den <span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite4" value="WheelerLodge" <%If Instr(arrCampSite,"WheelerLodge") Then Response.Write("disabled")End IF%>>Wheeler 
   Lodge<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite5" value="VenturerCabin" <%If Instr(arrCampSite,"VenturerCabin") Then Response.Write("disabled")End IF%>>Venturer 
   Cabin<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite6" value="Pool" <%If Instr(arrCampSite,"Pool") Then Response.Write("disabled")End IF%>>Pool<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite7" value="Canoe" <%If Instr(arrCampSite,"Cabin") Then Response.Write("disabled")End IF%>>Canoe 
   Trailer<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite8" value="Trailer" <%If Instr(arrCampSite,"Trailer") Then Response.Write("disabled")End IF%>>Canoes<span lang="en-us"><br>
   <br>
      <input type="checkbox" name="CampSite9" value="TentSite1" <%If Instr(arrCampSite,"TentSite1") Then Response.Write("disabled")End IF%>>Tent 
   Site 1<span lang="en-us"><br>
   <br>
   <input type="checkbox" name="CampSite10" value="TentSite2" <%If Instr(arrCampSite,"TentSite2") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 2<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite11" value="TentSite3" <%If Instr(arrCampSite,"TentSite3") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 3<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite12" value="TentSite4" <%If Instr(arrCampSite,"TentSite4") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 4<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite13" value="TentSite5" <%If Instr(arrCampSite,"TentSite5") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 5<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite14" value="TentSite6" <%If Instr(arrCampSite,"TentSite6") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 6<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite15" value="TentSite7" <%If Instr(arrCampSite,"TentSite7") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 7<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite16" value="TentSite8" <%If Instr(arrCampSite,"TentSite8") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 8<span lang="en-us"><br>
   <br>
<input type="checkbox" name="CampSite17" value="TentSite9" <%If Instr(arrCampSite,"TentSite9") Then Response.Write("disabled")End IF%>></span>Tent 
   Site 9<span lang="en-us"><br>
   <br>

   
   
   Please select one<span style="font-weight: 700; font-size: 8pt"><font color="#FF0000" size="1">*</font></span></b></font></font></font></font></font></font></font></font></font></font></font></font><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1">
     <tr>
       <td width="6%"><b><span style="font-weight: 700; font-size: 8pt">
   <input type=radio name="SCOUTING" value="YES" onclick="setReadOnly(this)"></span></b></td>
       <td width="94%" colspan="2"><b><span style="font-weight: 700; font-size: 8pt">SCOUTING 
       GROUP</span></b></td>
     </tr>
     <tr>
       <td width="6%"><b><span style="font-weight: 700; font-size: 8pt">
<input type=radio name="SCOUTING" value="NO" onclick="setReadOnly(this)"></span></b></td>
       <td width="47%"><b><span style="font-weight: 700; font-size: 8pt">NON SCOUTING  GROUP </span></b>
<select size="1" name="TypeOfUse">
   <option>..</option>
   <option>Guiding</option>
   <option>Church</option>
   <option>Cadets</option>
   <option>School</option>
   <option>Other</option>
   </select><b>   <br>   <font size="1">    </font></b></td>
       <td width="47%"><b> <span style="font-weight: 700; font-size: 8pt"><font size="1">
<input type=text name="OTHER" size="50"><br>
       </font></span>   <font size="1">NAME OF YOUR NON SCOUTING ORGANIZATION   


 
</font>   </b>
       
       </td>
     </tr>
   </table>
   
   <p><!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select size="1" name="TypeOfCamp">
   <option>Please select type of Camp</option>
   <option>Day Use</option>
   <option>Area Event</option>
   <option>Camp</option>
   <option>Training</option>
   <option>Meeting</option>
   <option>Other</option>
   </select><b><span style="font-weight: 700; font-size: 8pt"><font color="#FF0000" size="1">*</font></span><br>
   <span style="font-weight: 700; font-size: 8pt"><font size="1">
   <br>


 
</font></span><font size="1">
   <br>
   </font><span style="font-weight: 700; ">Contact information <br>
   </span><span style="font-weight: 700; font-size: 8pt"> <font size="1">
<br>
</font><b><font size="1">FIRST NAME<font color="#FF0000">*</font> </font></b><font size="1"> <input name="FIRSTNAME" size="28" value="" maxlength="255">  
</font><b><font size="1">LAST NAME<font color="#FF0000">*</font>  </font></b><font size="1"> <input name="LASTNAME" size="26" value="" maxlength="255"><br>
   <br>
   ADDRESS<font color="#FF0000">*</font><br>
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="ADDRESS" size="50" value="" maxlength="255"><br>
   <br>
CITY<font color="#FF0000">*</font><br>
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="CITY" size="12" value="" maxlength="255">  PROVINCE <!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="PROVINCE" size="13" value="ONTARIO" maxlength="255">   POSTAL  CODE<font color="#FF0000">*</font> <!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="POSTALCODE" size="7" value="" maxlength="255">  <br>
<br>
PHONE<font color="#FF0000">*</font>
<input name="PHONE" size="22" value="" maxlength="255">  
(519-777-7777)</font></span></b><p><b><span style="font-weight: 700; font-size: 8pt"> <font size="1">COUNCIL<br>
<select size="1" name="REGION">
<option>BATTLEFIELDS</option>
<option>TRISHORES</option>
<option>CENTRAL ESCARPMENT</option>
<option>OTHER</option>
</select>   <br>
AREA   </font></span><font face="Arial" size="2"><select size="1" name="AREA">
                          <option>Please select an area</option>
                          <option>South Waterloo</option>
                          <option>LONDON</option>
                          <option>BLUEWATER</option>
                          <option>St. Catharines</option>
                          <option>Merritt Trail</option>
                          <option>Lynn Valley</option>
                          <option>Brant</option>
                          <option>NIAGARA</option>
						<option>HAMILTON_WENTWORTH</option>
                          <option>Mohawk Trails</option>
                          <option>Hermitage Springs</option>
                          <option>Albion Mills</option>
                          <option>Fruitbelt</option>
                          <option>Haldimand</option>
                          <option>FRONTIER</option>
                          <option>WINDSOR</option>
                          <option>ESSEX</option>
                          <option>ELGIN</option>
                          <option>CHATHAM/KENT</option>
                          <option>MINDAAMIN</option>
                          <option>SYDENHAM</option>
                          <option>Other not listed</option>
                          <option value="N/A">N/A</option>
                        </select></font><span style="font-weight: 700; font-size: 8pt"><font face="Arial" size="2"> </font><font size="1"><br>
<br>
SCOUT GROUP<br>
<input type=text name="CAMPGROUP" size="20">  SECTION   <select size="1" name="SECTION">
<option>.....</option>
<option>BEAVERS</option>
<option>CUBS</option>
<option>SCOUTS</option>
<option>VENTURERS</option>
<option>ROVERS</option>
<option>TRAINING</option>
<option>OTHER</option>
</select><br>
<br>
</font>Numbers that will be attending camp:<font size="1"> YOUTH  <!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="16" --><input name="YOUTH" size="3" value="0" maxlength="16">ADULTS 
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="16" --><input name="ADULTS" size="3" value="0" maxlength="16"></font></span></b><p><b><span style="font-weight: 700; font-size: 8pt">CHECK IN TIME<font color="#FF0000" size="1">*</font>  <font size="1"> <!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="CHECKINTIME" size="17" value="" maxlength="255">  CHECK OUT TIME<font color="#FF0000">*</font> 
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="255" --><input name="CHECKOUTTIME" size="18" value="" maxlength="255"><br>
<br>
   <br />
SPECIFICS<font color="#FF0000"> - ADD IN HERE ANYTHING ELSE YOU WISH TO LET 
THE RANGER KNOW*<br>
</font>


 
</font></span><span style="font-weight: 700; background-color:#FFFF00">
<font size="1">BOOK CAMP PROGRAM KITS HERE </font></span><span style="font-weight: 700; font-size: 8pt"> <font size="1"><br>
<textarea rows="2" name="SPECIFICS" cols="48"></textarea><br>
<br>
EMAIL<font color="#FF0000">*</font>
<!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="EMAIL" size="50" value=""><br>
<br>
The email you provide is where the confirmation forms will be sent... if you 
cannot provide an email please type "NA"<br>
<br>
PASSWORD<font color="#FF0000">*</font><br>
<!--webbot bot="Validation" s-display-name="PLEASE ENTER A 3 TO 9 LETTER/NUMBER PASSWORD" b-value-required="TRUE" i-minimum-length="3" i-maximum-length="9" --><input name="PASSWORD" size="10" value="" maxlength="9"><br>
<br>
                    <font size="2">This password is assigned by you and will allow you to go back in
          and view the information you have booked. 
          The password must be a minimum of 3 characters max 9 (can be letters or
          numbers)</font><p>
      <font size="2">Changes to information can be made by calling 519-432-2928 or toll free 1-888-726-8876
          or
          email <a href="mailto:trishorescamps@scouts.ca" target="_blank">trishorescamps@scouts.ca</a>.</font></p>

   <p><input type="submit" value="Submit" name="Submit" onclick="return checkcheckboxes(this.form)"></p>
   <input type="hidden" name="DateStart" value="<%=varDateStart%>">
	<input type="hidden" name="DateEnd" value="<%=varDateEnd%>">
	<input type="hidden" name="CampName" value="4">

      <input type="hidden" name="BOOKINGNUMBER" value="0">
<input type=hidden name=RecordCount value=<%=RD%>>


</form>


 
</font></body>

</html>
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Way to block off dates in booking system - 2/23/2007 17:22:28   
I am a bit confused. If the start date is before 3/19/2007, then why even query the database at all? What happens if you place the code below at the very beginning of the page?

<%
varDateStart = CDate(Request.Form("DateStart"))
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
response.end
end if
%>[/quote]

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to raksha)
raksha

 

Posts: 92
Joined: 3/6/2003
Status: offline

 
RE: Way to block off dates in booking system - 2/23/2007 22:11:32   
They've asked because the camp is not available and they don't want bookings going through...
:) That didn't work... it didn't catch it..



(in reply to BeTheBall)
raksha

 

Posts: 92
Joined: 3/6/2003
Status: offline

 
RE: Way to block off dates in booking system - 2/23/2007 22:12:46   
They've asked me to have it so no one can book a date earlier than March 19th..
:) Code didn't work - I just the page as normal...
quote:

ORIGINAL: BeTheBall

<%
varDateStart = CDate(Request.Form("DateStart"))
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
response.end
end if
%>



(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Way to block off dates in booking system - 2/23/2007 22:18:29   
What if you do this?

<%
varDateStart = CDate(Request.Form("DateStart1"))
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
response.end
end if
%>

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to raksha)
raksha

 

Posts: 92
Joined: 3/6/2003
Status: offline

 
RE: Way to block off dates in booking system - 2/24/2007 9:32:51   
It now blocks everything - but maybe that's what it's suppose to do...
I had wanted that if someone entered a date after March 19th it would proceed

Duane... I changed the SQL to this:
mySQL = "SELECT CampSite FROM PEACEHAVEN3A WHERE (((#"&varDateStart&"# Between DateStart And DateEnd) OR (#"&varDateEnd&"# Between DateStart And DateEnd)) and (#"&varDateStart&"# >= 3/19/2007))"

It doesn't work.. but it should.. If I change the AND to an OR it does but blocks everything..

< Message edited by raksha -- 2/24/2007 13:57:05 >

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Way to block off dates in booking system - 2/24/2007 13:55:59   
Something's up. Is it printing the message: "Camp not available to book till after March 19th"?

Can you post a link?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to raksha)
raksha

 

Posts: 92
Joined: 3/6/2003
Status: offline

 
RE: Way to block off dates in booking system - 2/24/2007 13:58:02   
Hi
I think we posted at the same time.. I edited my previous message - i chose the route of changing the SQL...

Yes,... I do get the message...

Link:
This is to the first page where the date is passed - enter a date and it takes you to it..
I will set it up with your suggested code..

http://www.trishores-scouts.on.ca/campbookings1/1PEACEHAVEN/INFOCamppeaceTEST.asp

(in reply to BeTheBall)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Way to block off dates in booking system - 2/24/2007 15:28:57   
OK. What happens if you replace the code I provided above:

<%
varDateStart = CDate(Request.Form("DateStart1"))
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
response.end
end if
%>

With:

<%
varDateStart = CDate(Request.Form("DateStart"))
response.write varDateStart
response.end
%>

It should output the start date from the previous page. If it does, then this should work:

<%
varDateStart = CDate(Request.Form("DateStart"))
If varDateStart <= 3/19/2007 then
response.write ("Camp not available to book till after March 19th")
response.end
end if
%>


_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to raksha)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Way to block off dates in booking system
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts