Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I NEED HELP, In my applicatio

Status
Not open for further replies.

ashw

MIS
Jun 10, 2002
61
CA
Hi, I NEED HELP,
In my application, we can add policy and attach its relevant document thru a form. the document is upload to a file on the server. besides the policy title, policy content, date created, department and author, the document name is stored in database as wpattachment (by using CFFILE.serverFile when INSERTing) and document size as wpAttachmentSize (by using CFFILE.fileSize). The policy info can be seen thru a list. if we click the policy name on the list, it goes to a form where we can view and edit the details of policy. When I do that, all the details except the attachment is shown. I want the attachment path to show in the text box besides the browse button in the View/Edit form. So please HELP. here is the code for
EditViewPolicy.cfm
============================================================

<cfinclude template=&quot;/Header.cfm&quot;>

<head>
<title>View/Edit Job</title>

<!---View Edit selected Policy--->
<CFQUERY name=&quot;Policy&quot; Datasource=&quot;whitepaper&quot;>
SELECT *
FROM tblWhitePaper
WHERE wpID = #URL.wpID#
</CFQUERY>

<!---CF Query to get departments--->
<cfquery name=&quot;DeptList&quot; datasource=&quot;whitepaper&quot; dbtype=&quot;ODBC&quot;>
Select DeptID, Dept
From TblDepartment
Order BY Dept
</cfquery>

<!--Javscript for validating Policy content--->
<script language=&quot;javascript&quot;>
function validate(obj)
{
if(obj.wpcontent.value.length==0){
alert(&quot;Enter Policy Content!&quot;);
obj.wpcontent.focus();
return false;}
}
</script>

<!--Setting Submit as Default button-->
<script language=&quot;javascript&quot;>
function submitform() {
Attachment.submit()
}
</script>
</head>
<body>
<cfoutput>
<cfloop query=&quot;DeptList&quot;>
<cfif Dept is &quot;#Session.Auth.Dept#&quot;>
<cfset DeptDefault=&quot;#DeptID#&quot;>
</cfif>
</cfloop>
</cfoutput>

<!---Cold Fusion Form Action: Submits to SubmitEditPolicy--->
<cfform action=&quot;SubmitEditPolicy.cfm&quot; name=&quot;ViewEditPolicy&quot;
method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;
OnSubmit=&quot;return validate(ViewEditPolicy);&quot;>


<table border=&quot;0&quot; width=&quot;384&quot;>
<tr>
<th colspan=&quot;2&quot;>View /Edit Policy</th>
</tr>
<tr>
<td width=&quot;109&quot;>Title</td>
<td width=&quot;265&quot;>
<!--View and edit Existing Information-->
<cfoutput query=&quot;Policy&quot;>
<!--Pass wpID to SubmitEditPolicy.cfm for Editing-->
<input type=&quot;hidden&quot; name=&quot;wpID&quot; value=&quot;#wpID#&quot;>

<cfinput type=&quot;text&quot; name=&quot;wpTitle&quot; value=&quot;#wpTitle#&quot;
MESSAGE=&quot;Title is required!&quot; REQUIRED=&quot;Yes&quot;>
</td>
</tr>
<tr>
<td>Content</td>
<td>
<textarea name=&quot;wpcontent&quot; rows=&quot;6&quot; cols=&quot;60&quot;>
#wpcontent#</textarea>
</td>
</tr>

<tr>
<td>Date Created</td>
<td>
<cfinput type=&quot;text&quot; name=&quot;wpDateCreated&quot; value=&quot;#wpDateCreated#&quot;
MESSAGE=&quot;Date Created is required!&quot; Required=&quot;Yes&quot;> i.e MM/DD/YYYY
</td>
</tr>

<tr>
<td>Department</td>
<td>
<cfselect name=&quot;wpdept&quot; value=&quot;Deptid&quot; display=&quot;Dept&quot;
selected=&quot;#wpdept#&quot; query=&quot;DeptList&quot;
size=&quot;1&quot; multiple=&quot;No&quot;
Message=&quot;Department is required!&quot; Required=&quot;yes&quot;>
</cfselect>
</td>
</tr>

<tr>
<td>Author</td>
<td>
<cfinput type=&quot;text&quot; name=&quot;wpAuthor&quot;
value=&quot;#session.Auth.LastName#, #session.auth.firstname#&quot;
MESSAGE=&quot;Author is required!&quot; Required=&quot;Yes&quot;>
</td>
</tr>


<tr>
<td>Attachment</td>
<td>
<input type=&quot;file&quot; name=&quot;wpAttachment&quot; size=&quot;40&quot;

accept=&quot;application/msword,application/msexcel,application/pdf,text/html,application/rtf&quot;
class=&quot;button2&quot;>

</td>
</tr>
<tr>
<td colspan=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit Form&quot;>
<input type=&quot;Button&quot; name=&quot;Cancel&quot; value=&quot;Cancel&quot;
onClick=&quot;window.location='AdminPolicy.cfm';&quot;>
</td>
</tr>
</cfoutput>
</table>
</cfform>
</body>
<cfinclude template=&quot;/footer.cfm&quot;>

 
> I want the attachment path to show in the text
> box besides the browse button in the View/Edit form.

So where are you going to get that information from? Was it stored in the database and returned in the query called &quot;Policy&quot;? Are you asking how to display it on the form next to the bowse button?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top