OMG, OMG, OMG what a bone head I am....thanks for catching that email
password slip, this is what I get for posting too late at night after an
especially long and laborious day.  Thanks, many thanks!!!  Chris, I'll give
that a try, thanks.

On Fri, Sep 25, 2009 at 11:45 AM, Chris Champion <[email protected]
> wrote:

> Duane, I'm short on time today but here are some quick thoughts:
>
>    - I don't think populating cfswitch/cfcase via a query will work. Those
>    tags are logic branching code that will are interpreted when the page
>    is compiled into Java bytecode by the CF server. On the other hand, the 
> data
>    from the cfquery isn't obtained until the page is run, and may change each
>    time the page is run... so you cannot do it this way. The compiler can't 
> run
>    the query, and the query results cannot alter the compilation. Catch-22.
>    - Instead I think you should just pass along url.acn through the mail
>    composition form, and just use it in the action page to perform another
>    query for that specific faculty member's email. Let the database handle the
>    filtering, it'll be much faster than returning all the rows and filtering 
> by
>    looping over the results and comparing things.
>    - Finally, be sure to change the email address & password that you
>    posted in the code sample ASAP -- CFUG discussions are viewable on the web!
>
> Sorry I only have time to give a partial answer, but I hope it helps.
> -CPC
> --
> Chris Champion
> Co-Manager, Houston CFUG
>
> On Thu, Sep 24, 2009 at 11:56 PM, dixonCNS <[email protected]> wrote:
>
>>
>> Please do not try to email someone on the live test page, they are not
>> going to intended parties and they will not be expecting the messages
>> either, thanks.
>>
>> Duane Dixon
>>
>> On Sep 24, 9:18 pm, dixonCNS <[email protected]> wrote:
>> > Okay, I'm not sure if this is possible but I am trying to dynamically
>> > populate all the cfcase tags for a specific cfswitch.  Depending on
>> > what page a user selects is what case values will be filled in for the
>> > switch to work.  I have a page that populates our faculty members from
>> > a DB along with bios and now email addresses.  I am having trouble
>> > with the email address part.  It is a light box type of window that
>> > will come up and allow a user to type in a message to a specific
>> > faculty member and then submit the message all without the user
>> > leaving the main faculty listing page.  Here is a link to the test
>> > page I set uphttp://hspva.org/faculty/index2.cfm.  I am including the
>>  > code for the pages involved in this as well.  Any help would be
>> > greatly appreciated, I had my boss dump this on me yesterday for a
>> > Monday implementation, ugh!  This is my first post but have been
>> > following for a couple of years now and am more a all OJT and no
>> > formal CF training.  So, I do have some holes in my
>> > understanding.  ;-)
>> >
>> > Duane Dixon
>> >
>> > <code>
>> >
>> > This is the faculty listing
>> >
>> page-----------------------------------------------------------------------
>> ---------------------------------------------
>> >
>> > <!--- query for department name for the navigation and breadcrumbs ---
>> >
>> > <cfquery name="qryDepartmentName" datasource="Donorbas_hspva">
>> >         select  D.DepartmentID,
>> >                         D.DepartmentName,
>> >                         D.FormalDepartmentName
>> >         from    tblDepartments D
>> >         where   D.DepartmentID = #url.DepartmentID#
>> > </cfquery>
>> >
>> > <!--- query for faculty bio information table --->
>> > <cfquery name="qryFacultyBios" datasource="Donorbas_hspva">
>> >         select  F.DepartmentIDFK,
>> >                         F.FirstName,
>> >                         F.MiddleName,
>> >                         F.LastName,
>> >                         F.Email,
>> >                         F.Bio,
>> >                         D.DepartmentID,
>> >                         D.DepartmentName
>> >         from    tblFaculty F,
>> >                         tblDepartments D
>> >         where   D.DepartmentID = F.DepartmentIDFK and D.DepartmentID =
>> > #url.DepartmentID#
>> >         order by F.LastName
>> > </cfquery><head><!--- test for setting up page title, if DepartmentID
>> > is 0 then default title, else specific department page title --->
>> >         <cfif url.DepartmentID is 0><title>hspva.org | faculty</
>> > title><cfelse><cfoutput query="qryDepartmentName"><title>hspva.org |
>> > #qryDepartmentName.DepartmentName# department faculty</title></
>> > cfoutput></cfif>
>> > <cfinclude template="/metaContent.htm"> <!--- include the meta content
>> > file --->
>> > <cfinclude template="/dhtml/header-dhtml.cfm"> <!--- include the
>> > header file, contains the navigation, style sheets and javascript file
>> > links --->
>> >
>> > <script type="text/javascript" src="/Scripts/jquery.js"></script>
>> > <script type="text/javascript" src="/Scripts/thickbox.js"></script>
>> > <link type="text/css" rel="stylesheet" href="/styleSheets/
>> > thickbox.css" media="screen" />
>> >
>> > <div id="center">
>> >     <div id="centercontent">
>> >                 <!-- Content goes here! --><!--- test for setting up
>> breadcrumbs, if
>> > DepartmentID is 0 then default breadcrumb, else specific breadcrumb ---
>> >
>> >                 <cfif url.DepartmentID is 0><p class="breadCrumbs"><a
>> href="/">home</
>> > a> &gt; faculty</p>
>> >
>> >                 <p>Please select a department from the list to your
>> right.</
>> > p><cfelse>
>> >                 <cfoutput query="qryDepartmentName"><p
>> class="breadCrumbs"><a
>> > href="/">home</a> &gt; <a href="/faculty/"> faculty</a> &gt;
>> > #qryDepartmentName.DepartmentName# department faculty</p>
>> >                 <h3><a name="artDepartment"></
>> > a>#qryDepartmentName.FormalDepartmentName# Department Faculty</h3></
>> > cfoutput>
>> >                 <dl><cfoutput query="qryFacultyBios"><cfset anchorName =
>> "#replace
>> > ("#qryFacultyBios.FirstName#", " ", "", "all")##replace
>> > ("#qryFacultyBios.LastName#", " ", "", "all")#">
>> >                         <dt><!-- #qryFacultyBios.FirstName#
>> #qryFacultyBios.LastName#'s
>> > Biography -->
>> >                                 <a
>> name="#anchorName#"></a>#qryFacultyBios.FirstName#
>> > #qryFacultyBios.MiddleName# #qryFacultyBios.LastName# - <a
>> > href="contactForm.cfm?
>> >
>> KeepThis=true&TB_iframe=true&height=350&width=500&acn=#anchorName#&Departme
>> ntID=#url.DepartmentID#"
>>  > class="thickbox">e-mail</a>
>> >                         </dt>
>> >                         <dd><cfif qryFacultyBios.Bio is ""><cfset
>> qryFacultyBios.Bio =
>> > "&nbsp;"></cfif><!--- test and see if qryFacultyBios.Bio is empty and
>> > if it is place a non-breaking space as it's value. --->
>> >                                 <p>#qryFacultyBios.Bio#</p>
>> >                         </dd>
>> >                 </cfoutput></dl></cfif>
>> >         </div>
>> >   </div>
>> >   <div id="right">
>> >     <div id="rightcontent">
>> >                 <!-- News goes here! -->
>> > <cfif isDefined("url.DepartmentChoice")>
>> >         <cfinclude template="/departments/rightNavigation/
>> > departmentNavigation.cfm">
>> > <cfelse>
>> >         <cfinclude
>> template="rightContent/facultyIndexPageNavigation.cfm">
>> > </cfif>
>> >     </div>
>> >   </div>
>> >   <div id="footer">
>> >         <!-- Footer information! -->
>> > <cfinclude template="/footercontent.cfm">
>> >   </div>
>> > </body>
>> > </html>
>> >
>> > This is the light box
>> >
>> page.----------------------------------------------------------------------
>> ------------------------------------------------------
>> >
>> > <!--- query for faculty bio information table --->
>> > <cfquery name="qryFacultyEmail" datasource="Donorbas_hspva">
>> >         select  F.DepartmentIDFK,
>> >                         F.FirstName,
>> >                         F.MiddleName,
>> >                         F.LastName,
>> >                         F.Email,
>> >                         D.DepartmentID,
>> >                         D.DepartmentName
>> >         from    tblFaculty F,
>> >                         tblDepartments D
>> >         where   D.DepartmentID = F.DepartmentIDFK and D.DepartmentID =
>> > #url.DepartmentID#
>> >         order by F.LastName
>> > </cfquery>
>> >
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> > <html xmlns="http://www.w3.org/1999/xhtml";>
>> > <head>
>> >     <meta http-equiv="Content-Type" content="text/html;
>> > charset=utf-8" />
>> >     <title>Contact HSPVA</title>
>> >     <style>
>> >         td, div, p, input, select, textarea {
>> >                 font-family:Arial, Helvetica, sans-serif;
>> >                 font-size:12px;
>> >         }
>> >         </style>
>> >     <script type="text/javascript" src="/Scripts/prototype.js"></
>> > script>
>> >     <script type="text/javascript">
>> >         function checkForm(){
>> >                 var error = 0;
>> >                 var error_msg = "There was an error with your
>> submission:\n\n";
>> >
>> >                 if($('contactName').value == ""){ error = 1; error_msg
>> += "- Please
>> > enter your Name.\n"; }
>> >                 if($('contactEmail').value == ""){ error = 1; error_msg
>> += "- Please
>> > enter your Email.\n"; }
>> >                 if($('contactPhone').value == ""){ error = 1; error_msg
>> += "- Please
>> > enter your Phone.\n"; }
>> >                 if($('contactComments').value == ""){ error = 1;
>> error_msg += "-
>> > Please enter your Comments.\n"; }
>> >
>> >                 error_msg += "\nPlease correct the errors above and
>> resubmit the
>> > form.\n";
>> >
>> >                 if(error == 1){
>> >                         alert(error_msg);
>> >                         return false;
>> >                 }else{
>> >                         return true;
>> >                 }
>> >         }
>> >         </script>
>> > </head>
>> > <body>
>> > <!--- Load through jQuery ONLY! --->
>> > <cfif NOT isdefined("url.KeepThis") and NOT isdefined("TB_iframe")>
>> >         <cfabort showerror="Direct access not allowed!">
>> > </cfif>
>> >
>> > <cfset facultyName = "" >
>> > <cfset facultyEmail = "" >
>> > <cfset anchorName = "#replace("#qryFacultyEmail.FirstName#", " ", "",
>> > "all")##replace("#qryFacultyEmail.LastName#", " ", "", "all")#">
>> > <cfif "#url.acn#" is "#anchorName#">
>> >         <cfset facultyName = "#qryFacultyEmail.FirstName#
>> > #qryFacultyEmail.LastName#">
>> >     <cfset facultyEmail = "#qryFacultyEmail.Email#">
>> > <cfoutput query="qryFacultyEmail" startrow="2"><cfelseif "#url.acn#"
>> > is "#anchorName#">
>> >         <cfset facultyName = "#qryFacultyEmail.FirstName#
>> > #qryFacultyEmail.LastName#">
>> >     <cfset facultyEmail = "#qryFacultyEmail.Email#">
>> > </cfoutput><cfelse><cfabort showerror="Bad parameter?">
>> > </cfif>
>> >
>> > <!--- <cfswitch expression="#url.acn#" >
>> >         <cfoutput query="qryFacultyEmail"><cfcase value="#anchorName#">
>> >                 <cfset facultyName = "#qryFacultyEmail.FirstName#
>> > #qryFacultyEmail.LastName#">
>> >         <cfset facultyEmail = "#qryFacultyEmail.Email#">
>> >     </cfcase>
>> >     </cfoutput><cfdefaultcase><cfabort showerror="Bad parameter?"></
>> > cfdefaultcase>
>> > </cfswitch> --->
>> >
>> > <cfif isdefined("form.faculty_contact")>
>> >         <!--- Do Form Functions --->
>> >     <cfoutput>
>> >         <cfset fromEmail = ToString(#form.contactEmail#) >
>> >         <cfif REFindNocase("^[_a-z0-9-]+(\.[_a-z0-9-]+)*...@[a-z0-9-]+(\.
>> > [a-z0-9-]+)*\.(([a-z]{2,3})|(com|net|org|biz|info))$", fromEmail)>
>> >            <!--- Good email:
>> >
>> >                    server, username, and password MUST be updated!
>> >
>> >                    --->
>> >            <cfmail
>> >            server="smtp.gmail.com"
>> >            username="[email protected]"
>> >            password="avpsh123"
>> >            port="465"
>> >            useSSL="true"
>> >            to="#[email protected]"
>>  >            from="#fromEmail#"
>> >            replyto="#fromEmail#"
>> >            subject="New Contact from HSPVA.org"
>> >            type="html">
>> >            <p>#form.contactName# (<a
>> > href="mailto:#fromEmail#";>#fromEmail#</a>) sent you the following
>> > message:<br />
>> >                    Phone: #form.contactPhone#</p>
>> >            <hr />
>> >            <p>#form.contactComments#</p>
>> >                 </cfmail>
>> >         <cfelse>
>> >            <!--- Bad email:FAIL --->
>> >            <cfabort showerror="It appears the email address you
>> > entered is not valid?  Please try again.">
>> >         </cfif>
>> >     </cfoutput>
>> > <cfelse>
>> >         <!--- Show Form --->
>> >     <cfoutput>
>> >     <form name="facultyContact" id="facultyContact" method="post"
>> > onsubmit="return checkForm()">
>> >     <input type="hidden" name="faculty_contact" value="" />
>> >     <table width="500" cellpadding="4" cellspacing="0" border="0">
>> >           <tr>
>> >                 <td colspan="2"><h3>Contact Faculty:
>> #facultyName#</h3></td>
>> >         </tr>
>> >         <tr>
>> >                 <td>Your Name</td>
>> >             <td><input type="text" name="contactName"
>> > id="contactName" /></td>
>> >         </tr>
>> >         <tr>
>> >                 <td>Your Email</td>
>> >             <td><input type="text" name="contactEmail"
>> > id="contactEmail" /></td>
>> >         </tr>
>> >         <tr>
>> >                 <td>Your Phone</td>
>> >             <td><input type="text" name="contactPhone"
>> > id="contactPhone" /></td>
>> >         </tr>
>> >         <tr>
>> >                 <td valign="top">Your Message</td>
>> >           <td valign="top"><textarea cols="50" rows="10"
>> > name="contactComments" id="contactComments"></textarea></td>
>> >         </tr>
>> >         <tr>
>> >                 <td colspan="2" align="center"><input type="button"
>> > name="cancel" value="Cancel"
>> > onclick="javascript:window.parent.tb_remove();" />
>> >             <input type="submit" name="Submit" value="Submit" /></td>
>> >         </tr>
>> >     </table>
>> >     </form>
>> >     </cfoutput>
>> > </cfif>
>> > </body>
>> > </html>
>> >
>> > </code>
>> >>
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Houston ColdFusion 
Users' Group" discussion list.
To unsubscribe, send email to [email protected]
For more options, visit http://groups.google.com/group/houcfug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to