Edit Records

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>
LVL 7
sr_millarAsked:
Who is Participating?
 
meth0Connect With a Mentor Commented:
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
 
Ryan ChongCommented:
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
 
meth0Commented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
sr_millarAuthor Commented:
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
 
Ryan ChongCommented:
Is the codes above from edit.cfm? or if it's different, try post the code of edit.cfm here...
0
 
sr_millarAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.