getting values of checkboxes.

getting values of checkboxes.

am 30.11.2007 17:52:04 von jodleren

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

Re: getting values of checkboxes.

am 30.11.2007 20:15:03 von Jerry Stuckle

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.
jstucklex@attglobal.net
==================

Re: getting values of checkboxes.

am 30.11.2007 21:38:50 von Courtney

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..

Re: getting values of checkboxes.

am 30.11.2007 21:50:25 von luiheidsgoeroe

On Fri, 30 Nov 2007 21:38:50 +0100, The Natural Philosopher wrot=
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, an=
d
>>> 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 t=
o =

>> keep track of which boxes are checked (or all boxes with their previo=
us =

>> 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=3D' event handler to set the hidden variables up correct=
ly. =

> 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

Re: getting values of checkboxes.

am 30.11.2007 22:18:31 von Jerry Stuckle

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.
jstucklex@attglobal.net
==================