Checkboxes Update

2000-04-12 Thread Jeffrey M. Placzek

This is a multi-part message in MIME format.

--=_NextPart_000_0029_01BFA4CB.75848A40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This may be a basic question but...

I need to update multiple checkboxes on an update form... how do I get =
it to pass the checked or unchecked state to the update form? or radio =
buttons? or drop down menus?
In desperate need.. all you pros please respond to my email address =
right away if you can
Insanity is about to set in. help...

-Jeff

--=_NextPart_000_0029_01BFA4CB.75848A40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTMLHEAD
META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type
META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR
STYLE/STYLE
/HEAD
BODY bgColor=3D#ff
DIVFONT face=3DArial size=3D2This may be a basic question =
but.../FONT/DIV
DIVnbsp;/DIV
DIVFONT face=3DArial size=3D2I need to update multiple checkboxes on =
an update=20
form... how do I get itnbsp;to pass the checked or unchecked state to =
the=20
update form? or radio buttons? or drop down menus?/FONT/DIV
DIVFONT face=3DArial size=3D2In desperate need.. all you pros please =
respond to=20
my email address right away if you can/FONT/DIV
DIVFONT face=3DArial size=3D2Insanity is about to set in.=20
help.../FONT/DIV
DIVnbsp;/DIV
DIVFONT face=3DArial size=3D2-Jeff/FONT/DIV/BODY/HTML

--=_NextPart_000_0029_01BFA4CB.75848A40--

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: Checkboxes Update

2000-04-12 Thread John Quarto-vonTivadar

Hi Jeff,

well on your display page you want to do several things

1) name all your checkboxes the same (that way a single variable, called
FORM.yourcheckboxname will get passed to the action page
2) generate a list of the currently checked items (the ones checked before
the user starts toggling). Store in a hidden field, since you will want to
use this later on the action page. If you get these from a DB then you can
just convert the query to a list. For example you have a list of categorys
and the persons has some favorites already chosen. You get these from a DB
and also convert it as well as a query of *all* the categories. Loop thru
the full list and for each one if CategoryID is also part of the user-chosen
list you just made then set its value to CHECKED. This gets you a full
display of all the checkboxes with the ones previously checked now
pre-checked. You've also stored the previously checked ones in a list
variable in a hidden field of the form.
3) on the action page do this:  oldlist is a list of your previously chosen
categorys. Newlist comes directly from the checkboxes all being named the
same---and only the ones that are checked when the form gets submitted will
come thru. Then compare as below to see what is new and what is old,
updating the DB throughout.

!--- do group distribution here ---
cfset oldlist = ATTRIBUTES.UserCategoryIDList
cfset newlist = ATTRIBUTES.Category_ID
!--- if an item appears in the new list but not in the old then add it to
the table ---
cfloop list="#newlist#" index="item" DELIMITERS=","
 cfif ListContains(oldlist,item) EQ 0
  CFQUERY DATASOURCE="#APPLICATION.dsn#" NAME="additem"
   INSERT INTO Persons2Categorys (
PersonID,
CategoryID
)
   VALUES (
#SESSION.User.ID#,
#item#
)
  /CFQUERY
 /cfif
/cfloop

!--- if an item appears in the old list but not in the new then delete it
from the table ---
cfloop list="#oldlist#" index="item" DELIMITERS=","
 cfif ListContains(newlist,item) EQ 0
  CFQUERY DATASOURCE="#APPLICATION.dsn#" NAME="deleteitem"
   DELETE FROM Persons2Categorys
   WHERE 0=0
   AND  CategoryID = #item#
   AND  PersonID = #SESSION.User.ID#
  /CFQUERY
 /cfif
/cfloop

hope that helps.

- Original Message -
From: Jeffrey M. Placzek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 12, 2000 11:07 PM
Subject: Checkboxes Update


 This is a multi-part message in MIME format.

 --=_NextPart_000_0029_01BFA4CB.75848A40
 Content-Type: text/plain;
 charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable

 This may be a basic question but...

 I need to update multiple checkboxes on an update form... how do I get =
 it to pass the checked or unchecked state to the update form? or radio =
 buttons? or drop down menus?
 In desperate need.. all you pros please respond to my email address =
 right away if you can
 Insanity is about to set in. help...

 -Jeff

 --=_NextPart_000_0029_01BFA4CB.75848A40
 Content-Type: text/html;
 charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable

 !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
 HTMLHEAD
 META content=3D"text/html; charset=3Diso-8859-1" =
 http-equiv=3DContent-Type
 META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR
 STYLE/STYLE
 /HEAD
 BODY bgColor=3D#ff
 DIVFONT face=3DArial size=3D2This may be a basic question =
 but.../FONT/DIV
 DIVnbsp;/DIV
 DIVFONT face=3DArial size=3D2I need to update multiple checkboxes on =
 an update=20
 form... how do I get itnbsp;to pass the checked or unchecked state to =
 the=20
 update form? or radio buttons? or drop down menus?/FONT/DIV
 DIVFONT face=3DArial size=3D2In desperate need.. all you pros please =
 respond to=20
 my email address right away if you can/FONT/DIV
 DIVFONT face=3DArial size=3D2Insanity is about to set in.=20
 help.../FONT/DIV
 DIVnbsp;/DIV
 DIVFONT face=3DArial size=3D2-Jeff/FONT/DIV/BODY/HTML

 --=_NextPart_000_0029_01BFA4CB.75848A40--

 --

 Archives: http://www.eGroups.com/list/cf-talk
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.