sr_millar
asked on
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=GetFileFromPat h(GetTempl atePath()) >
<cfquery name="AllOpen" datasource="IT">
SELECT *
FROM Results
WHERE Results.Status = 'no'
</cfquery>
<cfset QueryString_AllOpen=Iif(CG I.QUERY_ST RING NEQ "",DE("&"&XMLFormat(CGI.QU ERY_STRING )),DE("")) >
<cfset tempPos=ListContainsNoCase (QueryStri ng_AllOpen ,"PageNum_ AllOpen=", "&")>
<cfif tempPos NEQ 0>
<cfset QueryString_AllOpen=ListDe leteAt(Que ryString_A llOpen,tem pPos,"&")>
</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> </p>
<table width="60%" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col">Update</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </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.ProblemOutlin e#</td>
<td>#AllOpen.ProblemStatus #</td>
<td>#AllOpen.Status#</td>
</tr>
</cfoutput>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>
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=GetFileFromPat
<cfquery name="AllOpen" datasource="IT">
SELECT *
FROM Results
WHERE Results.Status = 'no'
</cfquery>
<cfset QueryString_AllOpen=Iif(CG
<cfset tempPos=ListContainsNoCase
<cfif tempPos NEQ 0>
<cfset QueryString_AllOpen=ListDe
</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> </p>
<table width="60%" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col">Update</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </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>#AllOpen.MonthReported
<td>#AllOpen.YearReported#
<td>#AllOpen.ProblemType#<
<td>#AllOpen.ProblemOutlin
<td>#AllOpen.ProblemStatus
<td>#AllOpen.Status#</td>
</tr>
</cfoutput>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>
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.
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.
ASKER
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
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
Is the codes above from edit.cfm? or if it's different, try post the code of edit.cfm here...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
<cfset CurrentPage=GetFileFromPat
<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(CG
<cfset tempPos=ListContainsNoCase
<cfif tempPos NEQ 0>
<cfset QueryString_AllOpen=ListDe
</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> </p>
<table width="60%" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col">Update</th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
<cfoutput query="AllOpen">
<tr>
<td>
<input name="Update" type="button" id="Update" value="Update" onClick="edit.cfm?updateTi
<td>#AllOpen.TicketNo#</td
<td>#AllOpen.Name#</td>
<td>#AllOpen.Priority#</td
<td>#AllOpen.DayReported#<
<td>#AllOpen.MonthReported
<td>#AllOpen.YearReported#
<td>#AllOpen.ProblemType#<
<td>#AllOpen.ProblemOutlin
<td>#AllOpen.ProblemStatus
<td>#AllOpen.Status#</td>
</tr>
</cfoutput>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>