473,783 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting values of checkboxes.

Hi all!

I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).

But - I only get the $_POST value, it the item was checked.

How do I do it the other way?

Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.

WBR
Sonnich
Nov 30 '07 #1
7 1604
jodleren wrote:
Hi all!

I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).

But - I only get the $_POST value, it the item was checked.

How do I do it the other way?

Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.

WBR
Sonnich
HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their previous
status) in hidden fields.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 30 '07 #2
Jerry Stuckle wrote:
jodleren wrote:
>Hi all!

I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).

But - I only get the $_POST value, it the item was checked.

How do I do it the other way?

Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.

WBR
Sonnich

HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their previous
status) in hidden fields.
Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..

Nov 30 '07 #3
On Fri, 30 Nov 2007 21:38:50 +0100, The Natural Philosopher <a@b.cwrote:
Jerry Stuckle wrote:
>jodleren wrote:
>>Hi all!

I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).

But - I only get the $_POST value, it the item was checked.

How do I do it the other way?

Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.

WBR
Sonnich
HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their previous
status) in hidden fields.

Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..
Why not have a no javascript required fallback just as easily? An
array_diff() is quick & easy, and I'd say a lot faster to implement then
the javascript solution.
--
Rik Wasmus
Nov 30 '07 #4
The Natural Philosopher wrote:
Jerry Stuckle wrote:
>jodleren wrote:
>>Hi all!

I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).

But - I only get the $_POST value, it the item was checked.

How do I do it the other way?

Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.

WBR
Sonnich

HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their
previous status) in hidden fields.

Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..

I don't require users to have javascript enabled. Rather, I allow
additional features if they do have it enabled.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 30 '07 #5
On Nov 30, 10:50 pm, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
On Fri, 30 Nov 2007 21:38:50 +0100, The Natural Philosopher <a...@b.cwrot e:


Jerry Stuckle wrote:
jodleren wrote:
Hi all!
>I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).
>But - I only get the $_POST value, it the item was checked.
>How do I do it the other way?
>Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.
>WBR
Sonnich
HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their previous
status) in hidden fields.
Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..

Why not have a no javascript required fallback just as easily? An
array_diff() is quick & easy, and I'd say a lot faster to implement then
the javascript solution.
I took a look at that, I and see the idea, still I see another way -
based on all ideas here:
- a hidden input (could be an array comma separated etc...), such as
"value=yes/no"
- a checkbox, with value=yes

This does not require any java at the users end.

when returning, I have all the present value (when the page was
generated) and the changes. That means
- changes are easy to find
- I have a list of items listed (in case the list might have changed
while waiting for the users action).

I would at all avoid to compare returned data with "real ones", as
real data in my system might have changed. Therefore the hidden field
is useful here.

WBR
Sonnich
Dec 12 '07 #6
On Nov 30, 11:18 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
The Natural Philosopher wrote:
Jerry Stuckle wrote:
jodleren wrote:
Hi all!
>I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).
>But - I only get the $_POST value, it the item was checked.
>How do I do it the other way?
>Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.
>WBR
Sonnich
HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their
previous status) in hidden fields.
Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..

I don't require users to have javascript enabled. Rather, I allow
additional features if they do have it enabled.
Kind of OT, but JS is very important in some cases. I agree, keep the
option, though more can be done using JS.
Unfortunately, as always, there is also wrong way of using anything.
And that problem is against us, and will always be, not matter what we
are talking about.
Dec 12 '07 #7
jodleren wrote:
On Nov 30, 11:18 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>The Natural Philosopher wrote:
>>Jerry Stuckle wrote:
jodleren wrote:
Hi all!
I have a problem - I have a list of checkboxes, with certain data...
the point is, that some of them are set, and the important thing for
mere is to get those values, which have changed from CHECKED to NOT
CHECKED.
Certain values are marked, once done, the user removes the flags, and
I need to know what was set to not being checked anymore (to remove
them from the task list).
But - I only get the $_POST value, it the item was checked.
How do I do it the other way?
Hmmmmm while writing this, I wonder whether I can use isset() -
whether the value is set, but just empty... will check tomorrow.
WBR
Sonnich
HTML only sends checkboxes which are checked. One way to do it is to
keep track of which boxes are checked (or all boxes with their
previous status) in hidden fields.
Mmm. I tend to resort to javascript at this point, set up an array of
hidden variables, and every time a checkbox is ticked or unticked, use
the 'onchange=' event handler to set the hidden variables up correctly.
THEY all get sent in the post variable..
I don't require users to have javascript enabled. Rather, I allow
additional features if they do have it enabled.

Kind of OT, but JS is very important in some cases. I agree, keep the
option, though more can be done using JS.
Unfortunately, as always, there is also wrong way of using anything.
And that problem is against us, and will always be, not matter what we
are talking about.
I disagree. JS is NEVER important. It can enhance the use of a page,
but should never be *required* to use the page. Basic functionality
should *always* exist with JS disabled.

Unfortunately, too many sites don't follow this premise. And they lose
customers.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Dec 12 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2760
by: Alan Lambert | last post by:
I have a web page that contains, amongst other things, a DropDownList called drpProjectCodes) and a Panel (called pnlStatus) which contains six Checkboxes. drpProjectCodes contains a list of project codes plus an 'All' option. If All is selected then the user can selected statuses using the CheckBoxes otherwise the CheckBoxes are disabled by disabling pnlStatus. Several of the Checkboxes are checked by default. There are actually other...
7
5491
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the Repeater control, I've placed DropDownLists and CheckBoxes. When the user has updated the information, he/he clicks the submit button which is outside the scope of the Repeater control.
6
11898
by: rishabhshrivastava | last post by:
Hey All, Can someone suggest me a way to get the values of CheckBox(es) selected in a CheckBoxList control using JAVASCRIPT. I am pasting my current code gere but its not working need some suggestions pls. function CheckBoxList(cntrlName) { var cntrlValue = listValuesCheckBox(cntrlName); return cntrlValue ;
3
5625
by: somaskarthic | last post by:
Hi How to get the values of dynamically created checkboxes which are checked and unchecked (for both the conditions). Only the selected checkbox values are posted as 'On' . How can i get the value of unchecked checkboxes ? Each row contains 7 checkboxes. These rows are created dynamically by clicking a button. When the page is posted , i need to get the values as row1 checkbox1 = selected checkbox2 = notselected checkbox3 = selected...
6
10425
by: Chuck Anderson | last post by:
My knowledge of JavaScript is limited. I learn from example and then adapt those examples to suit my needs. I have stumped myself on this one. I have a form with checkboxes that I want to group by using a two dimensional array. <form name=msgs>
29
3154
by: Amer Neely | last post by:
I've got a dynamically built form with checkboxes for each element ( a list of file names in a directory). I need to grab only those checkboxes that are checked, so I can then delete those files. Does each checkbox name have to be unique? I was hoping to just group them under one name, and select from that array. PHP is not my native language - I'm coming at this from Perl, so bear with me, things are a little different in that country.
6
6247
by: bill | last post by:
Thanks to those that taught me to use heredoc to embed html in php. I don't want to start the html in php vs php in html discussion again., heredoc works a treat for that which I am doing except: In the generated html I have a number of checkboxes. I fill in the checkboxes from a boolean value in a mySQL table. To make this easier I use a function that takes the boolean and return either 'checked' or ''. This worked well when I was...
0
4102
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
1
2471
by: ttamilvanan81 | last post by:
Hai i have using the checkbox in for loop. I need the urgent help from anyone, for example in the loop there is having 5 checkbox if i checked 3 of the ckeckboxes and 2 of the checkboxes are unchecked. I need to get the values for checked checkboxes and unchecked checkboxes. Because if i checked the checkboxes, those values need to be inserted into the database. Those for unchecked checkboxes values need to be deleted from the database. Can...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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
8968
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...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.