What I've done in the past is a difference list. Since all your checkboxes
are named "FLanguage", you'll get a comma-delimited list of the languages
checked. If you also send a list of the languages that were originally
checked, you'll have enough information to determine what has changed.

I'll try to clarify. Add the following hidden form element:

<input type="hidden" name="originalFLanguages"
value="#Variables.currLanguages#">

Then your action page needs to compare the lists FLanguages and
originalFLanguages. Any item that appears on one list but not the other has
been changed. There are a couple of UDFs ad cflib.org that will do these
list comparisons for you, but it's not a hard algorithm to work out.

So, if I have German and Spanish checked, and want to change that to Spanish
and French. I uncheck German and check French. In your action page you'll
have:

Form.FLanguages: Spanish,French
Form.originalFLanguages: German,Spanish

French and German are different, so those are the values you want.

The shortcoming of this, though, is that you don't know the nature of the
change. This may be what you want. However, if you want to distinguish
between adding and removing...

..anything in Form.FLanguages but not in Form.OriginalFLanguages is a
language to add.
..anything in Form.OriginalFLanguages but not in Form.FLanguages is a
language to remove.

Again you can find a UDF on cflib.org to make this easier.

> -----Original Message-----
> From: Clark, Aimee [mailto:aclark@;stinsonmoheck.com]
> Sent: Wednesday, November 13, 2002 2:58 PM
> To: CF-Talk
> Subject: FW: Displaying values passed from one page into an email
> 
> 
> I realized that I didn't include enough info in my last 
> email. Here's what I
> omitted:
>  
> <CLARIFICATION>
>  
> The problem I am having is this: Let's say in my record it shows me as
> speaking just French. Well, now I want to add that I speak 
> Spanish. The
> value passed to the email is French, Spanish. 
>  
> Now, let's say I don't really speak Spanish very well, so I want that
> removed from my record. Well, the value passed is just the 
> first one in the
> list, so if you speak French, Spanish, it only shows that you 
> want French
> removed, not Spanish.
>  
> Thanks,
>     Aimee'
> -----Original Message-----
> From: Clark, Aimee 
> Sent: Wednesday, November 13, 2002 1:52 PM
> To: CF-Talk (E-mail)
> Subject: Displaying values passed from one page into an email
> 
> 
> I have a page that users are able to go into to see what is 
> currently listed
> for their employee information. If a user decides that they 
> need to change
> something like their home address and annotate that they 
> speak a foreign
> language, they can do so on this page and when they submit 
> the form, an
> email is generated that shows only the fields that they have modified.
>  
> Ok, so having said that, I can get everything they may modify 
> on the form to
> display correctly in the email EXCEPT the foriegn language field. 
>  
> This field is a dynamic checkbox, and they can select more 
> than one language
> if they happen to speak say, French and Spanish.
>  
> Here is the code for what is on the form:
>  
> <tr> 
>   <td><strong>Foreign Languages:</strong></td>
>   <td>
>   <cfloop query="GetLanguages">
>   <cfoutput>      
>    <input type="Checkbox" name="FLanguage" 
> value="#LanguageName#" <cfif
> #ListFindNoCase(LanguageList, '#GetLanguages.LanguageName#')#
> GT"0">Checked</cfif>>
>  #LanguageName#<BR>
>     </cfoutput>
>   </cfloop>
>   </td>
>   </tr>
>  
> Here are the queries, variables, and how I am finding their changes:
>  
> <-----------------QUERIES & 
> VARIABLES--------------------------------->
>  
> <cfquery datasource="FirmDaily" name="GetLanguages">
> select * from Languages order by LanguageName
> </cfquery>
>  
> <cfset currEmpLangs = "#ValueList(GetLanguages.LanguageName)#">
>  
> <cfquery datasource="FirmDaily" name="GetEmpLanguages">
> select * from EmployeeLanguages
> where EmpID = '#ID#'
> </cfquery>
>  
> <cfset currLanguages = "#ValueList(GetEmpLanguages.LanguageName)#">
>  
> <------Checking to see if there's something in the field that 
> was on the
> form------>
> 
> <cfif IsDefined('Form.FLanguage')>
> <cfset LangChoice = "#Form.FLanguage#">
> <cfelse>
> <cfset LangChoice = "0">
> </cfif>
>  
> <-------------Displaying whether to add or delete a language 
> based on what
> the user selected----------->
>  
> <cfloop list="#CurrEmpLangs#" index="i">
> <cfif (#ListFind(LangChoice, '#i#')# GT "0") AND 
> (#ListFind(currLanguages,
> '#i#')# EQ "0")>
> <tr>
> <td><b>Add Foreign Language:</b></td>
> <td>#LangChoice#</td>
> </tr>
> </cfif>
>  
> <cfif (#ListFind(LangChoice, '#i#')# EQ "0") AND 
> (#ListFind(currLanguages,
> '#i#')# GT "0")>
> <tr>
> <td><b>Remove Foreign Language:</b></td>
> <td>#GetEmpLanguages.LanguageName#</td>
> </tr>
> </cfif> 
> </cfloop>
>  
> Can anyone offer some insight into what I may be doing wrong here?
>  
> Thanks,
>  
> Aimee Clark 
> Web Developer 
> Stinson Morrison Hecker LLP 
> 816-691-3461 
> [EMAIL PROTECTED] 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to