Hey all.

This is likely a fairly easy task, but I'm completely new to CF so I'm not
how to do this.  I work for a small company (maybe 100 users) and I'm trying
to set-up form where people can submit change requests for our QA
documents.

Someone else created the initial form where users can submit the requests
and our document control person can then view table in their web browser and
see the requests.  It works like a simple held desk ticket system.  This all
works.

What they want me to add is a way to submit files at the same time.  This
way, users can edit the file(s) in question with their suggested changes for
the document control manager to look over.


So, first off, here's the code for the submission page (hope this
looks OK after I send it):


<cfset CurrentPage=
GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
  <cfquery datasource="QAA">
  INSERT INTO dbo.QMSUpdates
 (DocNumName, Request, Comments, RequestedBy, RequestedDate, DueDate,
Status, NeedStatus) VALUES (
  <cfif IsDefined("FORM.DocNumName") AND #FORM.DocNumName# NEQ "">
    '#FORM.DocNumName#'
      <cfelse>
      NULL

</cfif>
  ,
  <cfif IsDefined("FORM.Request") AND #FORM.Request# NEQ "">
    '#FORM.Request#'
      <cfelse>
      NULL
  </cfif>
  ,

<cfif IsDefined("FORM.Comments") AND #FORM.Comments# NEQ "">
    '#FORM.Comments#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.RequestedBy
") AND #FORM.RequestedBy# NEQ "">
    '#FORM.RequestedBy#'
      <cfelse>
      NULL

</cfif>
  ,
  <cfif IsDefined("FORM.RequestedDate") AND #FORM.RequestedDate# NEQ "">
    '#FORM.RequestedDate#'
      <cfelse>
      NULL
  </cfif>
  ,

<cfif IsDefined("FORM.DueDate") AND #FORM.DueDate# NEQ "">
    '#FORM.DueDate#'
      <cfelse>

      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.Status") AND #FORM.Status# NEQ "">
    '#FORM.Status#'
      <cfelse>
      NULL
  </cfif>
  ,
  <cfif IsDefined("FORM.NeedStatus") AND #FORM.NeedStatus# NEQ "">
    '#FORM.NeedStatus#'

      <cfelse>
      NULL
  </cfif>
  )

</cfquery>
  <cflocation url="uthanks.cfm">
</cfif>
<cfquery name=
"rsQMSUpdate" datasource="QAA">
SELECT     ID, DocNumName, Request, Comments, RequestedBy,
RequestedDate, DueDate, CompletedDate, Status, NeedStatus
FROM         QMSUpdates
</cfquery>
<cfquery name=
"rsEmployees" datasource="MI">
SELECT Employee.FullName, Employee.ID
FROM Employee
WHERE Employee.Status
 = 1
ORDER BY Employee.FullName
</cfquery>
<cfquery name=
"rsStatus" datasource="QAA">
SELECT  Distinct   Status
FROM         QMSUpdates
WHERE     (Status = 'New')
</cfquery>
<cfquery name=
"rsNeedStatus" datasource="QAA">
SELECT DISTINCT NeedStatus
FROM         QMSUpdates

</cfquery>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content=
"text/html; charset=iso-8859-1">
<title>Submit QMS Update
</title>
<link href="help.css" rel=
"stylesheet" type="text/css">
</head>

<body>
<p class=
"style1">Submit QMS Update</p>
<form method=
"post" name="form1" enctype="multipart/form-data" action=
"<cfoutput>#CurrentPage#</cfoutput>">
  <table align="left">
    <tr valign=
"baseline">
      <td nowrap align="right">Doc#/Name:</td>
      <td>
<input type="text" name="DocNumName" value=
"" size="50"></td>

</tr>
    <tr valign="baseline">

<td nowrap align="right" valign="top">Request:</td>
      <td>
<textarea name="Request" cols="50" rows=
"5"></textarea>
      </td>

</tr>
    <tr valign="baseline">

<td nowrap align="right" valign="top">Comments:</td>
      <td>
<textarea name="Comments" cols="50" rows=
"5"></textarea>
      </td>

</tr>
    <tr valign="baseline">

<td nowrap align="right">Requested By:</td>
      <td><select name=
"RequestedBy">
          <cfoutput query="rsEmployees">
            <option
value="#rsEmployees.FullName#">#rsEmployees.FullName#</option>
          </cfoutput>
        </select>
      </td>

<tr>
    <tr valign="baseline">

<td nowrap align="right">Requested Date:</td>
      <td><input type=
"text" name="RequestedDate"
value="<cfoutput>#DateFormat(now(),'m/dd/yy h:mm:ss')#</cfoutput>"
size="32">
</td>
    </tr>
    <tr valign=
"baseline">
      <td nowrap align="right">Date Needed :</td>
      <td>
<input type="text" name="DueDate" value=
"" size="32"></td>

</tr>
    <tr valign="baseline">

<td nowrap align="right">Select Urgency: </td>
      <td><select name=
"NeedStatus" id="NeedStatus">
        <cfoutput query="rsNeedStatus">
          <option value=
"#rsNeedStatus.NeedStatus#">#rsNeedStatus.NeedStatus#</option>

</cfoutput>      </select></td>

</tr>
    <tr valign="baseline">

<td nowrap align="right">&nbsp;</td>

<td><input type="submit" value=
"Submit"></td>
    </tr>

</table>
  <input type="hidden" name=
"Status" value="New">
  <input type=
"hidden" name="MM_InsertRecord" value="form1"
>
</form>
<p>&nbsp;
</p>
</body>
</html>



Now, from reading some info available on the web, I was able to put
together a basic upload form that seems to work fine:

<html>
<head>

<title>Upload File with ColdFusion</title>
</head>

<body>
<cfif isdefined("form.upload_now")>
<cffile action="upload" filefield="ul_path" destination=
"c:\inetpub\wwwroot\upload\" accept="image/jpeg, image/gif" nameconflict=
"makeunique">
The file was successfully uploaded!
</cfif>


<form action="cf_upload.cfm" method="post" name=
"upload_form" enctype="multipart/form-data" id="upload_form">
<input type="file" name=
"ul_path" id="ul_path">
<input type=
"submit" name="upload_now" value="submit"
>
</form>
</body>

</html>



But this is where I'm stuck.  How do I go about combing these two into
a single form with a single 'submit' button?  From what I can tell,
the current page (the first code) calls a second cfm file that
processes the data and sends and e-mail off to the document control
manager. I would like to retain that functionality.  Here is the code
for that page (e-mail of document control manager changed):

<cfquery name="rsEmailReq" datasource=
"QAADev">
SELECT     TOP (1) ID, DocNumName, Request, Comments, RequestedBy,
RequestedDate, DueDate, Status
FROM         QMSUpdates
ORDER BY ID DESC

</cfquery>
<cfmail to="[EMAIL PROTECTED]" from="[EMAIL PROTECTED]" subject=
"QMS Document Request" server="192.168.0.101">
RequestID: #rsEmailReq.ID#

Document Number or Name: #rsEmailReq.DocNumName#

Request:  #rsEmailReq.Request#

Comments: #rsEmailReq.Comments#

Requested By: #rsEmailReq.RequestedBy#
Requested Date: #rsEmailReq.RequestedDate#

Due Date: #rsEmailReq.DueDate#

</cfmail>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">

<title>Thank you for your submission....</title>
<link href=
"help.css" rel="stylesheet" type="text/css"
>
</head>

<body>

<p>Your request has been submitted to the QAA Document Control Group,
and will be processed. Someone will contact you shortly. </p>
<cflocation url="viewqmsupdates.cfm">

</body>
</html>



The table where this information is stored already has an unused field
named 'docs' where I'd like the location of the uploaded file to be
stored (the path).  I believe that field was added for this reason at
some point, but hasn't been used so far.  In the testing DB there are
a few file paths there in some of the test submissions.

I really hope all that made sense.  Let me know if any more
information required.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2758
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to