?
Solved

simple update record and email notification

Posted on 2005-04-11
7
Medium Priority
?
179 Views
Last Modified: 2013-12-24
I have a followup/update page that I would like the update statement to run for all records (anytime the page is accessed) and an email notification to be sent ONLY If one of the form fields = OSHA.

My psudo is like:

<cfif FORM.Code EQ "OSHA">
<cfmail
to="to_address_goes_here"
from="from_address_goes_here"
subject="subject_name_here">

Email message here
</cfmail>
</cfif>


Then I have my connection to db and update statement here...which works great if I take out the above.  What am I missing in my syntax?  Can I have a <cfmail>...</cfmail> within a <cfif>?  

The error I get is:
"The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfif>. If the body of the tag is empty you can use the shortcut <cfif .../>."
Stops at line 1:
<cfif FORM.Code EQ "OSHA">

Thanks!!!!
0
Comment
Question by:jhmoen
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 13756311
I bet there is some other error.

Can you post the whole code as the logic should work.
0
 

Author Comment

by:jhmoen
ID: 13756338
<cfif FORM.Code EQ "OSHA">
<cfmail
to="XXXXXXX"
from="XXXXXXXX"
subject="EHS HAZARDOUS WASTE DATABASE">
***AUTO GENERATED EMAIL NOTIFICATION FROM EHS DATABASE SYSTEM***

USU EHS Technician,

This is an auto-generated email to notify you of the following
hazardous "OSHA" coded chemical that was assigned by another EHS Technician to a
pickup within the EHS Database System.

Please be advised of the following:

INDEX: #FORM.index#-#FORM.containernum#
Submitted on: #FORM.SelectCommonName#
Contact Person: #FORM.contactperson#
Contact Phone: #FORM.contactphone#
Contact Email: #FORM.contactemail#

Contents: #FORM.contents#
Container Size: #FORM.containersize#
Waste Amount: #FORM.wasteamount#
Special Notes: #FORM.specialnotes#

USU Common Name:#FORM.SelectCommonName#

Estimated Weight: #FORM.weight#
Estimated Cost: #FORM.estcost#

Please Log into the user interface at www.usu.edu/ehs/waste to view the following chemical
properties associated with the above assigned chemical.


DOT Description:
Corrosive:
Oxidizer:
Shock Sensitive:
Air Reactive:
Water Reactive:
Marine Pollutant:
Toxicity (mg/kg):
FlashPoint:
EPA#:
Labels:
DOT Class:
UN Number:
Code:
Pkg. Group:
Pkg. Exceptions:
RQ Amount:
Pkg. Non Bulk:
Special Provisions:
</cfmail>
</cfif>

  <cfquery datasource="wastedb">
  UPDATE waste SET ContainerSize=
  <cfif IsDefined("FORM.containersize") AND #FORM.containersize# NEQ "">
    '#FORM.containersize#'
      <cfelse>
      NULL
  </cfif>
  , Amount=
  <cfif IsDefined("FORM.wasteamount") AND #FORM.wasteamount# NEQ "">
    #FORM.wasteamount#
      <cfelse>
      NULL
  </cfif>
  , ContactPerson=
  <cfif IsDefined("FORM.contactperson") AND #FORM.contactperson# NEQ "">
    '#FORM.contactperson#'
      <cfelse>
      NULL
  </cfif>
  , ContactEMail=
  <cfif IsDefined("FORM.contactemail") AND #FORM.contactemail# NEQ "">
    '#FORM.contactemail#'
      <cfelse>
      NULL
  </cfif>
  , ContactTelephone=
  <cfif IsDefined("FORM.contactphone") AND #FORM.contactphone# NEQ "">
    '#FORM.contactphone#'
      <cfelse>
      NULL
  </cfif>
  , Contents=
  <cfif IsDefined("FORM.contents") AND #FORM.contents# NEQ "">
    '#FORM.contents#'
      <cfelse>
      NULL
  </cfif>
  , WasteStorageArea=
  <cfif IsDefined("FORM.wastestoragearea") AND #FORM.wastestoragearea# NEQ "">
    '#FORM.wastestoragearea#'
      <cfelse>
      NULL
  </cfif>
  , SpecialNotes=
  <cfif IsDefined("FORM.specialnotes") AND #FORM.specialnotes# NEQ "">
    '#FORM.specialnotes#'
      <cfelse>
      NULL
  </cfif>
  , PickupDate=
  <cfif IsDefined("FORM.pickupdate2") AND #FORM.pickupdate2# NEQ "">
    '#FORM.pickupdate2#'
      <cfelse>
      NULL
  </cfif>
  , ProcessDate=
  <cfif IsDefined("FORM.processdate") AND #FORM.processdate# NEQ "">
    '#FORM.processdate#'
      <cfelse>
      NULL
  </cfif>
  , USUCommonName=
  <cfif IsDefined("FORM.SelectCommonName") AND #FORM.SelectCommonName# NEQ "">
    '#FORM.SelectCommonName#'
      <cfelse>
      NULL
  </cfif>
  , Category=
  <cfif IsDefined("FORM.category") AND #FORM.category# NEQ "">
    '#FORM.category#'
      <cfelse>
      NULL
  </cfif>
  , BinShelfPallet=
  <cfif IsDefined("FORM.binshelfpallet") AND #FORM.binshelfpallet# NEQ "">
    '#FORM.binshelfpallet#'
      <cfelse>
      NULL
  </cfif>
  , LIestWeight=
  <cfif IsDefined("FORM.weight") AND #FORM.weight# NEQ "">
    #FORM.weight#
      <cfelse>
      NULL
  </cfif>
  , LIestCost=
  <cfif IsDefined("FORM.estcost") AND #FORM.estcost# NEQ "">
    #FORM.estcost#
      <cfelse>
      NULL
  </cfif>
  WHERE wasteID=#FORM.wasteID#
  </cfquery>
  <cflocation url="/ehs/waste/hazwaste/pickups/">

0
 
LVL 35

Expert Comment

by:mrichmon
ID: 13756608
hmmm..

Well here is an interesting idea.  Try the query first and the cfif with cfmail afterwards.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:jhmoen
ID: 13756740
I got it.
This line: <cfif FORM.Code EQ "OSHA"> Should be a lower case "code" from my form.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 13757159
and that caused a cfif error?

very strange. I can see it not sending an email, but it shouldn't throw an error.

Oh unless "Code" is a reserved word - which it may be.

You could try HazCode or something like that.
0
 

Accepted Solution

by:
PAQ_Man earned 0 total points
ID: 13955122
PAQed with points refunded (50)

PAQ_Man
Community Support Moderator
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question