473,672 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Checkboxes

139 New Member
Hi,

I've been mulling it over but I can't get my head around how to achieve the following:

I have a page that displays jobs for a user. I'd like a checkbox which, when checked, removes jobs with the status of 'Completed', stays checked on the refresh of the page and then adds the Completed jobs when unchecked.

Is this doable? I've tried this but I can't get it to work.

Thanks
Neil
Jun 16 '11 #1
4 5415
acoder
16,027 Recognized Expert Moderator MVP
How does the page refresh occur? By a submit or via JavaScript?

What have you tried?
Jun 21 '11 #2
ndeeley
139 New Member
I've added a field called 'Visible' to my table to use to unselect records from view. I've used a copy of the page to toggle between the two states of seeing / not seeing the records, which sort of works, but doesn't display the checkbox text propery. I'd like all the code to be on the one page.

This is the code to select the records:

Expand|Select|Wrap|Line Numbers
  1. <cfif isDefined('mycheck')>
  2.  
  3. <cfif mycheck EQ 1>
  4.  
  5. <cfquery name="clearCompleted" datasource="taskbook">
  6.     update        tblTaskBooker
  7.     set            Invisible = 1
  8.     where        JobStatusFK = 'Completed' and AssignedToFK = '#username#'
  9. </cfquery>
  10.  
  11. <cfquery name="clearcheck" datasource="taskbook">
  12. update        tblStaff
  13. set            ClearC = 1 
  14. where        LoginName = '#username#'
  15. </cfquery>
  16.  
  17. </cfif>    
  18.  
  19. <cfelse>
  20. </cfif>
  21.  
And this the checkbox code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <form action="TB_ReviewGISA.cfm?mycheck=1" method="post">
  3.  
  4.  
  5. <cfif getAL.ClearC EQ 1>
  6. <input type="checkbox" name="clearC" value=1 checked="checked" onClick="this.form.submit();">
  7. Hide / Show completed tasks
  8.  
  9. <cfelse>
  10.  
  11. <input type="checkbox" name="clearC" value=1  onClick="this.form.submit();">
  12. Hide / Show completed tasks
  13. </cfif>
  14. </form>    
  15.  
  16.  
I use two pages, TBReviewGIS and TBReviewGISA.
Jun 22 '11 #3
acoder
16,027 Recognized Expert Moderator MVP
Is there a reason to update the database for hiding/showing? You could simply use a select statement to show only the records required.

Also, you can combine the 2 into one page by using the cfelse part for the query which displays all records (when the checkbox is unchecked) or as I stated above, use the cfif within the select statement, e.g.
Expand|Select|Wrap|Line Numbers
  1. select ...
  2. where ...
  3. <cfif mycheck EQ 1>some where clause</cfif>
One more thing: the checkbox display code could easily be combined into one piece:
Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="clearC" value=1
  2. <cfif getAL.ClearC EQ 1>checked="checked" </cfif>
  3. onClick="this.form.submit();">
  4. Hide / Show completed tasks
Jul 4 '11 #4
ndeeley
139 New Member
Thanks acoder, I'll give it a go - hopefully I'll have no problems!

Cheers
Neil
Jul 12 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2968
by: Gary | last post by:
Hello, Is it possible to dynamically update a textbox with words chosen from a list using form checkboxes and javascript? Gary
5
10109
by: Deborah V. Gardner | last post by:
I would like to use "Yes" and "No" checkboxes on a subform. The problem is that when I click the Yes checkbox on the subform, all of the checkboxes are checked. Currently, I have a field "Refused." It is defined as a text field. A "Y" means that the service has been refused; an "N" indicates it has been accepted. If the field is Null, the question has not been answered, i.e. we don't know if it has been refused or not. I want the user...
3
2133
by: Mark | last post by:
I am looking for an example of using checkboxes in a repeater control where the checkbox state is persisted from page to page. Thank you, Mark
5
7316
by: sianan | last post by:
I have an ASP.NET custom control, which contains a DataGrid with checkboxes. I am trying to figure out how to retrieve the selected records, based on the checkbox's checked state. I want to send the results to a list control on the containing .ASPX page. Here is what I have in my code behind (C#): <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication5.WebForm1" %> <!DOCTYPE HTML PUBLIC...
0
2006
by: Patrick.O.Ige | last post by:
I have a datagrid with checkboxes.. When a user clicks one check box and clicks the delete button it deletes that ROw. There another situation when a user clicks multiple rows so i had to loop throug the rows like so:- foreach (DataGridItem i in DataGrid1.Items) { CheckBox deleteChkBxItem = (CheckBox) i.FindControl ("DeleteRow"); if (deleteChkBxItem.Checked) {
0
2136
by: shameem | last post by:
hi 2 all, my question is how to delete the records by using checkboxes in datagrid. pls give reply to my question.
3
5148
by: mountain.dog | last post by:
I have a query that shows a list of options that a user can toggle on or off using a checkbox. query... form... while($row = mysql_fetch_array($result))... <input name="menu_show_attribute" type="checkbox" class="checkbox"'); if ($row == 1) { echo (' value="'.$row.'" checked />
1
2585
by: recordlovelife | last post by:
Hey guys, ill try to make this simple. I want to make a GUI for a client so that they can delete news entries that they have posted. I figure I can code a site that will query the table for the news and post the titles of all of the news entries, and put a check box next to each one. The name of the check box will be the id number of the row in the MySQL table where the news entry is located. So if they click a check box, when they hit submit,...
3
2794
by: parkergirl | last post by:
Hi, I have an msflexgrid that I need to select with checkboxes (I'm currently using WingDings font). The selection of rows cannot be anymore than three rows (randomly). Then, I need to take the data from the selected rows and populate that information into labels on another form. Can anybody help me with this? I'm assuming I need to use arrays some how. If anybody has any experience with this, please help! Thanks!
2
3076
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography section: Discography --------------------- DiscID
0
8486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.