?
Solved

Edit Records

Posted on 2005-03-10
6
Medium Priority
?
154 Views
Last Modified: 2010-04-25
Hi All,

I am really struggling with this - have just started learning DreamWeaver and ColdFusion.  I have an access database I have created which will log IT support calls.  I have created a page with a record set filtering Status as No (i.e. it will display all tickets that have not been resolved).  It displays this in a table setup as a repeat region so it shows all applicable records.  I have added a column to the table and want an update button in there so I can edit a specific record.  I have tried my best but it is not working here is the code:  If anyone can tell me how to do this it would be great.

<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfquery name="AllOpen" datasource="IT">
SELECT *
FROM Results
WHERE Results.Status = 'no'
</cfquery>
<cfset QueryString_AllOpen=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_AllOpen,"PageNum_AllOpen=","&")>
<cfif tempPos NEQ 0>
  <cfset QueryString_AllOpen=ListDeleteAt(QueryString_AllOpen,tempPos,"&")>
</cfif>
<!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>Untitled Document</title>
</head>

<body>
<form name="form1" method="get" action="edit.cfm">
  <p>&nbsp;</p>
  <table width="60%"  border="1" cellspacing="2" cellpadding="2">
    <tr>
      <th scope="col">Update</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
    </tr>
    <cfoutput query="AllOpen">
      <tr>
        <td><input type="submit" name="Submit" value="Update"></td>
        <td>#AllOpen.TicketNo#</td>
        <td>#AllOpen.Name#</td>
        <td>#AllOpen.Priority#</td>
        <td>#AllOpen.DayReported#</td>
        <td>#AllOpen.MonthReported#</td>
        <td>#AllOpen.YearReported#</td>
        <td>#AllOpen.ProblemType#</td>
        <td>#AllOpen.ProblemOutline#</td>
        <td>#AllOpen.ProblemStatus#</td>
        <td>#AllOpen.Status#</td>
      </tr>
    </cfoutput>
  </table>
  <p>&nbsp;</p>
  <p>    </p>
</form>
</body>
</html>
0
Comment
Question by:sr_millar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 13508717
Try this:

<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="updateTicket" default="">

<!--- Update Ticket --->
<cfif updateTicket neq "">
      <cfquery name="RsUpdate" datasource="IT">
      Update Results Set
      Status = 'yes'
      Where TicketNo = '#updateTicket#'
      </cfquery>
</cfif>

<cfquery name="AllOpen" datasource="IT">
SELECT *
FROM Results
WHERE Results.Status = 'no'
</cfquery>
<cfset QueryString_AllOpen=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_AllOpen,"PageNum_AllOpen=","&")>
<cfif tempPos NEQ 0>
  <cfset QueryString_AllOpen=ListDeleteAt(QueryString_AllOpen,tempPos,"&")>
</cfif>
<!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>Untitled Document</title>
</head>

<body>
<form name="form1" method="get" action="edit.cfm">
  <p>&nbsp;</p>
  <table width="60%"  border="1" cellspacing="2" cellpadding="2">
    <tr>
      <th scope="col">Update</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
      <th scope="col">&nbsp;</th>
    </tr>
    <cfoutput query="AllOpen">
      <tr>
        <td>
          <input name="Update" type="button" id="Update" value="Update" onClick="edit.cfm?updateTicket=#AllOpen.TicketNo#"></td>
        <td>#AllOpen.TicketNo#</td>
        <td>#AllOpen.Name#</td>
        <td>#AllOpen.Priority#</td>
        <td>#AllOpen.DayReported#</td>
        <td>#AllOpen.MonthReported#</td>
        <td>#AllOpen.YearReported#</td>
        <td>#AllOpen.ProblemType#</td>
        <td>#AllOpen.ProblemOutline#</td>
        <td>#AllOpen.ProblemStatus#</td>
        <td>#AllOpen.Status#</td>
      </tr>
    </cfoutput>
  </table>
  <p>&nbsp;</p>
  <p>    </p>
</form>
</body>
</html>
0
 
LVL 3

Expert Comment

by:meth0
ID: 13510951
When you use dreamweaver server behaviours to displaymultiple  records specifically for editing purposes, the idea is to impliment "master-detail pages". The page which displays the recordset and repeat region is the master page. When you select or click on a record, the ID of that record is passed to the detail page where it displays that particular record in detail.

You want to create the detail page so that it displays the editable details of the record in textfields, check boxes etc inside a form with an update(submit) button. Once you make the changes to the redord details, you hit the button and the record is updated.

Dreamweaver (or cold fusion) help files should have tutorial files which outline the exact steps to do master-detail pages. Do a search in the help files for "master detail" and you'll find it.
0
 
LVL 7

Author Comment

by:sr_millar
ID: 13514967
Guys,

Thanks for the responses - ryancys - the code did not work, when I click the update button nothing happens at all.  Meth0 - Checked the help files and cant see anything about master details - am going to check the web for this and will let you know.

Stuart
0
Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

 
LVL 53

Expert Comment

by:Ryan Chong
ID: 13517676
Is the codes above from edit.cfm? or if it's different, try post the code of edit.cfm here...
0
 
LVL 3

Accepted Solution

by:
meth0 earned 1500 total points
ID: 13521071
You must be using an early version of DW. There's a help >  tutorial in DW MX called "building a master-detail page" and plenty of help topics in DW MX 2004 when you do a search for "master detail"; I got about 20 results from that search in MX 2004 help files.

Which version do you have installed?
0
 
LVL 7

Author Comment

by:sr_millar
ID: 13542594
Meth0,

Thanks for the tips - my help does not display it for some reason (I will look into it), but I did a google search for the terms you suggested and I found information on how to do it.

Thanks for the help.

Stuart
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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