Book Section
-----
TY JavaScript 3rd Ed.
Teach Yourself JS 1.5
Teach Yourself DHTML
Teach Yourself JS 1.3
LLWW: JavaScript

General Section
-----
Discussion Forum
Articles / Tips
JavaScript Links
About the Author
Privacy Policy
Contact Me



Other Sites
-----
Website Workshop
JavaScript Weblog

JavaScript Workshop Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
DeSelect Checkboxes..Dont have a Clue.

 
Post new topic   Reply to topic    JSWorkshop Forum Index -> JavaScript
View previous topic :: View next topic  
Author Message
xclaim
New member
New member


Joined: 25 Feb 2003
Posts: 1

PostPosted: Tue Feb 25, 2003 10:54 am    Post subject: DeSelect Checkboxes..Dont have a Clue. Reply with quote

I am new to Programing. I just dove into this with no parachute, so please pardon my lack of knowledge. My quest: I have a group of checkboxes. This first is a checkbox using a regular <cfinput> text box that serves as "ALL". The remaining boxes are generated from <cfoutput> from the Database. I simply would like if the users clicked on a checkbox that was generated by the database to DeSelect the all checkbox. does anyone have any idea? Thanks.


Here is the Code Evil or Very Mad




<CFIF Session.loggedin IS "1">

<CFSET title="SFA Awards Reports - Generate Count Only Report">
<!---include header.cfm file --->
<CFINCLUDE TEMPLATE="header.cfm">
<!---

<script type="text/javascript" language="JavaScript1.2">
<!--//hide from older browsers

function checkawardtype() {
var index=1;

if (window.document.forms[0].award_id[index].checked == true)
{
document.forms[0].launch_event.disabled = true;
}

}

//-->

</script>

--->
<div align="left">
<font size="+1" face="Arial, Helvetica, sans-serif"><b>SFA Award Reports -
Generate Count Only Report</b></font><BR>
<a href="rule.gif"><IMG src="rule.gif" border="0" alt="blue dot" width="365" height="1"></a></div>



<!-- form url -->
<CFform name="reports" method="post" action="report_count_only.cfm">



<div align="center">
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr> <td width="26%" valign="top"> <div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>Report Format:</b></font></div></td>
<td width="74%">

<!-- Select output -->
<select name="format">
<option value="html" selected>HTML </option>
<option value="excel">Excel</option>
</select>
</td>
</tr>
<tr>

<td width="26%" valign="top"> <div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>Award Type:</b></font></div></td><td width="74%" height="50" nowrap>


<!-- Award type Query -->

<CFQUERY NAME="GetAwards" DATASOURCE="#datasource#">
SELECT * FROM SFA_Award ORDER BY Award_name </CFQUERY>
<font face="Arial, Helvetica, sans-serif">


<!-- single "All" checkbox. This checkbox needs to be deselected when any other checkbox generated by the database is selected -->
<CFinput type="checkbox" name="award_id" value="" CHECKED onclick="checkawardtype()"><font size="-1">All</font></font> <font face="Arial, Helvetica, sans-serif">

<!-- This is the output of the awards from database, when clickd the above all checkbox should be deselected -->
<cfoutput query="GetAwards">
<br>
<CFinput type="checkbox" name="award_id" value="#award_id#" onclick="checkawardtype()"><font size="-1">#Award_name#</font> </cfoutput>
</font><br><img src="rule.gif" width="365" height="1"> </td>
</tr>
<tr>


<td width="26%" valign="top"><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>Employer:</b></font></div></td><td width="74%">



<CFQUERY NAME="GetEmployers" DATASOURCE="#datasource#">
SELECT *
FROM Employer
ORDER BY Employer_name
</CFQUERY>

<select name="employer_name_dd" size="1">
<option value="" selected>All Employers...</option>
<cfoutput query="GetEmployers">
<option value="#GetEmployers.employer_name#">#GetEmployers.employer_name#</option>
</cfoutput>
</select>



</td>
</tr>
<tr>

<td width="26%" valign="top"> <div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>Event</b></font></div></td>
<td width="74%">

<cfinput type="Text" name="launch_event" value="" required="No" size="20" maxlength="20">
<font size="-1" face="Arial, Helvetica, sans-serif"><b>(eg:STS-xxx or 10th anniversary):</b></font> </td>
</tr>
<tr>

<td width="26%" valign="top"> <div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>Date Range:</b></font><BR>
<font size="-1"></font></div></td>
<td width="74%">
<input type="text" size="10" name="start_date" value=""> To <input type="text" size="10" name="end_date" value="">
<font size="-1" face="Arial, Helvetica, sans-serif"><b>(mm/dd/yyyy)</b></font> <br>
<img src="rule.gif" width="365" height="1"></td>
</tr>

<tr>
<td width="26%" valign="top"><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>SFA Panel:</b></font></div></td>
<td width="74%">



<!-- Panel type Query -->

<CFQUERY NAME="GetSFAPanel" DATASOURCE="#datasource#">
SELECT *
FROM SFA_Panel
ORDER BY Panel_name
</CFQUERY>


<!-- single "All" checkbox. This checkbox needs to be deselected when any other checkbox generated by the database is selected -->

<CFinput type="checkbox" name="panel_id" value="" CHECKED>
<font size="-1" face="Arial, Helvetica, sans-serif">All</font> <font face="Arial, Helvetica, sans-serif"><cfoutput query="GetSFAPanel">


<!-- This is the output of the awards from database, when clickd the above all checkbox should be deselected -->

<br>
<CFinput type="checkbox" name="panel_id" value="#panel_id#">
<font size="-1">#Panel_name#</font> </cfoutput></font><br>
<img src="rule.gif" width="365" height="1"> </td>
</tr>

<tr>
<td width="26%" valign="top"><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><b>NASA
Center:</b></font></div></td>
<td width="74%">


<CFQUERY NAME="GetNASACenter" DATASOURCE="#datasource#">
SELECT *
FROM nasa_center
ORDER BY center_name
</CFQUERY>

<CFinput type="checkbox" name="nasa_id" value="" CHECKED>
<font size="-1" face="Arial, Helvetica, sans-serif">All</font> <font face="Arial, Helvetica, sans-serif"><cfoutput query="GetNASACenter">
<br>
<CFinput type="checkbox" name="nasa_id" value="#nasa_id#">
<font size="-1">#center_name#</font> </cfoutput></font><cfoutput query="GetNASACenter"></cfoutput>
</td>
</tr>

</td>
</tr>

</td>
</tr>
</table>


</div>





<BR>
<div align="center">

<input type="submit" name="Submit" value="Submit">

<input type="Reset" name="Reset" value="Reset">
</div>

</CFform>



<!---include footer here--->
<CFINCLUDE TEMPLATE="footer.cfm">

<CFELSE>
<cflocation url="index.cfm" ADDTOKEN="No">
</CFIF>
_________________
Hello world
Back to top
View user's profile Send private message
phil karras
Senior Member
Senior Member


Joined: 15 Jul 2002
Posts: 1697
Location: MD

PostPosted: Tue Feb 25, 2003 12:06 pm    Post subject: Reply with quote

1. this site is for beginners, but we do expect you to Be sure to read the Guidelines for Posting.

Then post a KISS example that really "works" - shows the problem. Read my article about what a KISS example is.

Both links are below in my signature.


2. I have no idea what a <CFinput > or <CFoutput or <CFform...> is or means. I don't believe the CF parts are standard HTML and I've also never seen an <output> but that could just be my limited education showing. Wink

Now as for unchecking checkboxes, that's a little more involved that some standard simple JavaScript, you'll need to use the eval() method like this:
Code:

<html><head><title>Clear Check Boxes Test</title>
<script language="JavaScript" type='text/javascript' >
   function ClearChecks() {
      var max = document.ckbox.checkboxname.length;
      for (var i=0; i<max; i++) {
         eval("document.ckbox.checkboxname["+i+"].checked = false");
      }
   }
</script>
</head>
<body>
   <form name="ckbox" onSubmit='...' ...>
   .
   .
   .
   <input type="checkbox" name="checkboxname" value='100'>
   .
   .
   .
   <input type="checkbox" name="checkboxname" value='110'>
   <br>
   <input type='submit' name='submit' value='submit'>
      &nbsp; &nbsp;
   <input type='button' name='Clear' value='Clear All' onClick='javascript:ClearChecks();'/   >
</form>
</body>
</html>

Hope that helps.
_________________
Phil K
Circle Software Consulting
Test website: http://cs.yrex.com/
Guidelines for Posting: http://jsworkshop.com/posting.html
IHBAAA = It Has Been Asked And Answered
KISS: http://jsworkshop.com/bb/viewtopic.php?t=508
Back to top
View user's profile Send private message Visit poster's website
zachariah
Member
Member


Joined: 07 Sep 2002
Posts: 101
Location: Earth

PostPosted: Tue Feb 25, 2003 9:14 pm    Post subject: CF... Reply with quote

I am pretty sure cf... is a cold fusion tag (which is not html or javascript, rather a proprietary language made by allaire, but it looks like its now owned by macromedia). Hopefully you can track down a cold fusion programmer to help you out.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    JSWorkshop Forum Index -> JavaScript All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
(c) 1997-2002 Starling Technologies and Michael Moncur. Portions (c) Sams Publishing.