|
| |
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
Getting Select All value to work - 5/13/2004 15:26:37
I'm trying to get this to work I was reviewing other postings and I think this is what I'm suppose to do... It doesn't work... Thanks Sarah <input type="checkbox" name="CampSite" value="%">All Sites</td>
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Getting Select All value to work - 5/13/2004 16:19:31
What are you hoping to have it do? The % is a wildcard and is normally used for performing searches.
_____________________________
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.
|
|
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
RE: Getting Select All value to work - 5/13/2004 16:46:46
Hi Duane I'm hoping that that when the user selects this it selects all available campsites at the camp---and sends those to the next page... Sarah
|
|
|
|
TimC
Posts: 199 From: Greenville SC (& or) Monterrey Mexico Status: offline
|
RE: Getting Select All value to work - 5/13/2004 16:55:01
What you have posted: <input type="checkbox" name="CampSite" value="%">All Sites</td> Should display as "All Sites" on the page, and when checked should submit the wildcard "%" value for the fieldname of CampSite to whatever your form is submitting to (I presume a database search) If your field is named CampSite in the database then this should indeed return all the records - can you post the rest of the code between the <Form> </Form> tags - and give us some insight as to what happens now when you click submit ?
_____________________________
TimC " Today is so mixed up that I should have stood in bed"
|
|
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
RE: Getting Select All value to work - 5/13/2004 17:37:23
Hi Yes the CampSite field is "LIKE.... " There are a whole lot of checkboxes... with the Field as CampSite and the value is different It submits to a query page.... Maybe I'm not placing the all value on the right page.. Thanks Sarah
<body onUnload="CheckWindow();"><form method="POST" action="query4.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<div align="left">
<table border="0" width="398" align="left" cellpadding="3" style="border-collapse: collapse" cellspacing="0">
<tr>
<td width="929" colspan="3" height="29">
<p style="background-color: #000000; border-style: groove"><b><font color="#FFFFFF" size="5">
CAMP WETASKIWIN |
<a href="../camppictures/Impeesa/ImpeesaPictures.htm">Pictures</a></font></b></td>
</tr>
<tr>
<td width="478" height="60" colspan="2"><font size="1">PLEASE CHOOSE YOUR
SITE AND CHECK OR FILL IN THE APPROPRIATE BOXES BELOW </font></td>
<td width="445" height="60"></td>
</tr>
<tr>
<td width="239" valign="top" height="163"><b>Buildings</b><font size="1"><br>
<input type="checkbox" name="CampSite" value="Lodge"> Lodge<br>
<input type="checkbox" name="CampSite" value="Bunkhouse"> Bunkhouse<br>
<input type="checkbox" name="CampSite" value="Potlatch"> Potlatch</font></td>
<td width="239" valign="top" height="163"><b>Tenting</b><font size="1"><br>
<input type="checkbox" name="CampSite" value="Site1">Camp Site1<input type="checkbox" name="CampSite" value="Site1">Camp Site 2<input type="checkbox" name="CampSite" value="Site1">Camp Site 3<input type="checkbox" name="CampSite" value="Site1">Camp Site 4</font></td>
<td width="445" valign="top" rowspan="2">
<ul>
<li>
<font size="1"><b>Lodge -</b> The lodge </font></li>
<li><font size="1"><b>Bunkhouse</b>- Accomodates </font>
<span style="font-size: 8pt"> </span></li>
<li>
<b><font size="1">On site resources </font></b>
</li>
</ul>
<ul>
<li>
<font size="2">
<font color="#FF0000">
PHOTO GALLERY</font> FOR Camp
Wetaskiwin</font></li>
</ul>
<p>
DIRECTIONS to Camp Wetaskiwin<p>
<b>911# </b></td>
</tr>
<tr>
<td width="478" valign="top" height="162" colspan="2"><font face="Arial" size="2">
Start Date of Camp<font color="#FF0000">*</font> </font><font face="Arial"> <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="DateStart" size="27">
<br>
</font>
<font face="Arial" size="2">End
Date of Camp<font color="#FF0000">*</font> <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="DateEnd" size="27">
<br>
<br>
<br>
</font>
<input type="submit" value="Submit" name="B3"></td>
</tr>
<tr>
<td width="929" colspan="3" height="27"> </td>
</tr>
<tr>
<td width="929" colspan="3" height="27"><font size="1"><strong><!--webbot
bot="HitCounter" u-custom i-digits="0" i-image="4"
PREVIEW="<strong>[Hit Counter]</strong>" i-resetvalue="0" startspan
--><img src="../_vti_bin/fpcount.exe/campbookings1/?Page=Wetaskiwin/INFOCampWetaskiwin.asp|Image=4" alt="Hit Counter"><!--webbot
bot="HitCounter" endspan i-checksum="15191"
-->
</strong></font>
</td>
</tr>
</table>
</div>
<p><br>
</form>
</body>
</html>
< Message edited by rikki -- 5/13/2004 17:40:33 >
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Getting Select All value to work - 5/13/2004 21:50:36
Take this code and paste it into somewhere between the <head> and </head> tags: <script language="javascript"> var i function checkBoxes() { if (checkTheBoxes.checkAll.checked == true) { for (i=0; i < checkTheBoxes.CampSite.length; i++) { document.checkTheBoxes.CampSite.checked = true; } } if (checkTheBoxes.checkAll.checked == false) { for (i=0; i < checkTheBoxes.CampSite.length; i++) { document.checkTheBoxes.CampSite.checked = false; } } } </script> Then add this checkbox before all the others (In html view) <input type="checkbox" name="checkAll" onClick="checkBoxes()"> Click here to select all.<br> When a user checks the box, all the others will be marked automatically.
_____________________________
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.
|
|
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
RE: Getting Select All value to work - 5/14/2004 9:59:08
I entered the script... but it doesn't seem to do anything... Can you please take a look... Maybe I got something wrong.. Here's the code from the beginning to past the checkboxes... <html>
<head>
<script language="javascript">
var i
function checkBoxes() {
if (checkTheBoxes.checkAll.checked == true) {
for (i=0; i < checkTheBoxes.CampSite.length; i++) {
document.checkTheBoxes.CampSite.checked = true;
}
}
if (checkTheBoxes.checkAll.checked == false) {
for (i=0; i < checkTheBoxes.CampSite.length; i++) {
document.checkTheBoxes.CampSite.checked = false;
}
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-ca">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>CAMP WETASKIWIN </title>
<script language="Javascript">
</script>
<meta name="Microsoft Theme" content="blends 011">
</head>
<body>
<body onUnload="CheckWindow();"><form method="POST" action="query4.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<div align="left">
<table border="0" width="398" align="left" cellpadding="3" style="border-collapse: collapse" cellspacing="0">
<tr>
<td width="929" colspan="3" height="29">
<p style="background-color: #000000; border-style: groove"><b><font color="#FFFFFF" size="5">
CAMP WETASKIWIN |
<a href="../camppictures/Impeesa/ImpeesaPictures.htm">Pictures</a></font></b></td>
</tr>
<tr>
<td width="478" height="60" colspan="2"><font size="1">PLEASE CHOOSE YOUR
SITE AND CHECK OR FILL IN THE APPROPRIATE BOXES BELOW </font></td>
<td width="445" height="60"></td>
</tr>
<tr>
<td width="239" valign="top" height="163"><b>Buildings</b><font size="1"><br>
<input type="checkbox" name="checkAll" onClick="checkBoxes()" value="ON"> Click here to select all<br>
<input type="checkbox" name="CampSite" value="Lodge"> Lodge<br>
<input type="checkbox" name="CampSite" value="Bunkhouse"> Bunkhouse<br>
<input type="checkbox" name="CampSite" value="Potlatch"> Potlatch</font></td>
<td width="239" valign="top" height="163"><b>Tenting</b><font size="1"><br>
<input type="checkbox" name="CampSite" value="Site1">Camp Site1<input type="checkbox" name="CampSite" value="Site1">Camp Site 2<input type="checkbox" name="CampSite" value="Site1">Camp Site 3<input type="checkbox" name="CampSite" value="Site1">Camp Site 4 </font></td>
<td width="445" valign="top" rowspan="2">
<ul>
<li>
<font size="1"><b>Lodge -</b> The lodge </font></li>
<li><font size="1"><b>Bunkhouse</b>- Accomodates </font>
<span style="font-size: 8pt"> </span></li>
<li>
<b><font size="1">On site resources </font></b>
</li>
</ul>
<ul>
<li>
<font size="2">
<font color="#FF0000">
PHOTO GALLERY</font> FOR Camp
Wetaskiwin</font></li>
</ul>
<p>
DIRECTIONS to Camp Wetaskiwin<p>
<b>911# </b></td>
</tr>
<tr>
<td width="478" valign="top" height="162" colspan="2"><font face="Arial" size="2">
Start Date of Camp<font color="#FF0000">*</font> </font><font face="Arial"> <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="DateStart" size="27">
<br>
</font>
<font face="Arial" size="2">End
Date of Camp<font color="#FF0000">*</font> <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="DateEnd" size="27">
<br>
<br>
<br>
</font>
<input type="submit" value="Submit" name="B3"></td>
</tr>
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Getting Select All value to work - 5/14/2004 10:03:22
Try changing this line: <body onUnload="CheckWindow();"><form method="POST" action="query4.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript"> to <body onUnload="CheckWindow();"><form method="POST" action="query4.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="checkTheBoxes" language="JavaScript">
_____________________________
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.
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Getting Select All value to work - 5/14/2004 12:06:14
Javascript conflict. The validation you are using on the date fields is conflicting with the script for the "Select All". I am not even to the level of being considered a novice in Javascript, so all I could tell you would be to get rid of the FP validation on the two date fields, but that may cause you other problems. I would look for another way to validate the date fields.
_____________________________
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.
|
|
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
RE: Getting Select All value to work - 5/14/2004 20:10:27
HI Duane Just to let anyone know who might run into the same thing I got the select all button to work.. I have no idea why but it works! Thanks for all your help. Here's the code..(top of page) <script language = "Javascript">
<!--
var form='FrontPage_Form1' //Give the form name here
function SetChecked(val,chkName) {
dml=document.forms[form];
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if (dml.elements.name==chkName) {
dml.elements.checked=val;
}
}
}
function ValidateForm(dml,chkName){
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if ((dml.elements.name==chkName) && (dml.elements.checked==1)) return true
}
alert("Please select at least one record to be deleted")
return false;
}
// -->
</script>
<a href="javascript:SetChecked(1,'CampSite')">Click here to
select all sites</a></font><br>
<br>
<a href="javascript:SetChecked(0,'CampSite')"><font face="Arial, Helvetica, sans-serif" size="2">Clear
All</font></a></div><br>
|
|
|
|
rikki
Posts: 382 Joined: 4/4/2004 Status: offline
|
RE: Getting Select All value to work - 5/14/2004 20:12:09
What I'm finding is that it doesn't work... The value for All Sites is not being passed. It selects all the checkboxes and then goes to the 2nd form, but the value is not being caught by the query. Could I have too many values ? If I select only a few the query works. Otherwise, it seems to be ok , but the values are not entered into the database. Fixed this by changing the field length in the database!
< Message edited by rikki -- 5/14/2004 21:50:16 >
|
|
|
|
BeTheBall
Posts: 6355 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Getting Select All value to work - 6/3/2004 10:42:58
Here is some code that will allow you to have a "Check All" option with your new way of doing things. First, put this code in the <head> section of the page that has your checkboxes: <script>
var allBoxes = ["CampSite1", "CampSite2", "CampSite3", "CampSite1", "CampSite4", "CampSite5", "CampSite6", "CampSite7", "CampSite8", "CampSite9", "CampSite10", "CampSite11"];
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";
}
}
You just need to add the other 15 or so checkbox names. Then, above the code for the first checkbox, add this line: <input type=checkbox name="CheckAll" onClick="checkAll(this)"><span id="unCheck">Check</span> All<br> When a user checks the CheckAll box, all the other checkboxes will become checked. However, the disabled ones, will not submit to the database even though they will display as checked. They will also remain greyed-out. Give it a try and see if it's still what you want.
_____________________________
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.
|
|
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
|
|
|