473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Using Checkboxes

139 100+
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 5389
acoder
16,027 Expert Mod 8TB
How does the page refresh occur? By a submit or via JavaScript?

What have you tried?
Jun 21 '11 #2
ndeeley
139 100+
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 Expert Mod 8TB
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 100+
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
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
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...
3
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
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...
0
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...
0
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
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"...
1
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...
3
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...
2
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.