[thelist] checked vs. unchecked checkboxes

Gary McPherson lists at ingenyus.net
Tue Oct 19 18:56:50 CDT 2004


----Original Message----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Mark Joslyn
Sent: 20 October 2004 00:30
To: thelist at lists.evolt.org
Subject: RE: [thelist] checked vs. unchecked checkboxes
> 
> I have a bit of a follow-up.
> 
> I need an action to take place if the user unchecks the
> checkbox as well. Is there a way to record this "unchecking"
> event. It seems like the checkbox value just disappears once the item
> in "unchecked". 
> 
> So, the user checks a checkbox - they receive emails - the
> user unchecks the checkbox, then they do not receive emails.
> 
> Any insights on this.
> 
> markJ

I think the simplest way to handle this would be to process all available
options each time that form is submitted. Create a hashtable (or the PHP
equivalent - it's not my strongest language, sorry) with every option's
value set to false by default, compare it with the form array and update all
submitted values to true. Then update each corresponding field in your
datastore to true or false accordingly. A little more work for the db, sure
- but spares you the headache of trying to trap the nebulous "unselect"
events.

Cheers,

Gary

P.S.
Take care when editing previous replies as you may confuse the Tip Harvester
when it comes across your email, including the opening tagline of Noah's tip
without the closing line.




More information about the thelist mailing list