Link to home
Start Free TrialLog in
Avatar of Jerome Slaughter
Jerome SlaughterFlag for United States of America

asked on

produce an <input type="select"> when editing a table row in a table

Hello Experts. The below code works successfully for what I need it to do. It allows an edit of data in a table row. What I would like for my coldfusion code to do further is display and allow selection from combo boxes during an table row edit. Some of the data comes from a database table where the values are in a combo box list. This would be great during an edit. I know I could do a <input type="select"  of a table row by listing the value options but what if more values are added in the database table at a later date? How does the <input type="select"> values get updated then? It would be nice via a cfquery?   Hopefully my question makes sense and thanks in advance.
<!-- If URL.From is defined and equals DoEdit, then update the table -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "DoEdit">

<CFUPDATE DATASOURCE="SSPSRs" TABLENAME="Issues">

</CFIF>
</CFIF>


<!-- The below code selects all data from the table -->

<CFQUERY NAME="all" DATASOURCE="SSPSRs">
select * from Issues where user_name = <cfoutput>'#url.user_name#'</cfoutput>;
</CFQUERY>



<body>
<a href="trackertabs.cfm?user_name=<cfoutput>#url.user_name#</cfoutput>&tab=2">
<img src="http://127.0.0.1:8500/TicketTracking/pics/imagesCA6WFWX0.jpg" width=50 height=50 alt="go back to service tab" border="0" /></a> 
</body>
<br>

<body> 
<center>
<font size=6 font face="Copperplate Gothic Ligth">
My Service Requests (All)
</font>
</center>
<br>
</body>


<body>

<!-- If DoUpdate has been run a short note is given -->

<CFIF IsDefined("DoUpdate.RecordCount")>
<p><b>Thanks for your update!</b>
</CFIF>



<table border='0' width='100%' align='center' summary='script output'>

<tr bgcolor="#d3d3d3">
<th bgcolor="#d3d3d3"><font size=2><b>Service<br> Request #</b></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Request</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Network</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Assigned To</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Customer</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Opened Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Closed Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Status</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Priority</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Description</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Date Completed</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Comments</strong></font></th>
<th></th>
</tr>

<!-- Here we check for the URL.From attribute -->

<CFIF IsDefined("URL.From")>

<!-- If URL.From just equals DoEdit, we simply just output the data, just as if it was undefined  -->

<CFIF #URL.From# IS "DoEdit">



<cfoutput query="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>

<CFELSE>

<CFLOOP QUERY="all">

<CFIF #URL.ID# IS #all.Ticket_Num#>

<CFOUTPUT>

<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">

<tr bgcolor="iif(currentrow MOD 1,DE('123456'))">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2><input type="text" name="Title" size="25" value="#Title#"></font></td>
<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Customer" size="25" value="#Customer#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="10" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="10" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="10" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="10" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="10" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="25" value="#Comments#"></font></td>
</tr>

</CFOUTPUT>

<CFELSE>

<!-- This is where all the data get's nicely output into the table -->

<cfoutput>
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<td>
</td>
</tr>
</CFOUTPUT>

</CFIF>

</CFLOOP>

</CFIF>

<!-- If URL.From is undefined -->

<CFELSE>

<CFOUTPUT QUERY="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td> 
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>

</CFIF>

<!-- If URL.From is defined and equals Edit, then display an update button and close the form -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "Edit">

<tr>
<td colspan="3">
<CFOUTPUT>
<input type="hidden" name="Ticket_num" value="#URL.ID#">
</CFOUTPUT><br>
<br>
<br>
<input type="submit" value="Update">
</form>
</td>
</tr>

</CFIF>
</CFIF>

</table>

</body>

Open in new window

SOLUTION
Avatar of tampatechtiger
tampatechtiger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in the above code you can add one more checking for current selected item.

 
<select name="dropdown">
    <cfouput query="dropdownvalues">
        <option value="#dropdownvalues.itemID#" <cfif all.itemID eq dropdownvalues.itemID>selected="selected"</cfif>>#dropdownvalues.itemDescription#</option>
    </cfoutput>
</select>

Open in new window

Avatar of Jerome Slaughter

ASKER

Your code above is where I need to get my code. I'm still not getting the result I strive for.  This is what my code should do and display:

1. There is a displayed .cfm page of results.
2. The edit capability (edit buttons are displayed for each row of displayed results) is implemented on the page via the coldfusion code.
3. User clicks an edit button to edit a row of results.
4. The row is highlighted for edit.
5. User changes the values as needed during the edit.
6. Some of the edited values should be selectable via a drop down box (values listed per a cfquery).  
7. user clicks "update"

With my current code I am able to do an edit and change the text values successfully. It would be nice to be able to allow drop down boxes for values that need to be changed.

Unfortunately I still haven't had any luck getting what I want to happen with my code.  With the code example below I just wanted to see if it would put a drop down box for manual <input type="select" name="Title">

<CFOUTPUT>

<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">

<tr bgcolor="iif(currentrow MOD 1,DE('123456'))">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2><input type="select" name="Title"><option>Password Request</option></input></font></td>
<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Customer" size="25" value="#Customer#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="10" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="10" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="10" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="10" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="10" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="25" value="#Comments#"></font></td>
</tr>

</CFOUTPUT>

Open in new window

Avatar of _agx_
> <input type="select" name="Title">

AFAIK there is no such thing as <input type="select">. If you want to create a drop down list, you have to use a <select> element as the other 2 experts showed.  Whatever elements you want displayed in the drop down list should come from a *separate* query.

ie Not the "all" query you seem to be using for the main form.

<CFQUERY NAME="all" DATASOURCE="SSPSRs">
select * from Issues where user_name = <cfoutput>'#url.user_name#'</cfoutput>;
</CFQUERY>
( no points please.  i'm just paraphrasing what tampatechtiger already said ...)


In other words, to display a drop down list you have to use a <select> element not <input>
ie
        <select name="Title"><option>Password Request</option></select>


... selectable via a drop down box (values listed per a cfquery).

If you want to populate the list items from a db, you need to run a separate query. Grab the values from your db table:

<cfquery name="getListValues" datasource="yourDSN">
    SELECT TheListID, TheListText
    FROM    YourTableOfValues
</cfquery>

Open in new window


Then use cfoutput to generate the list <options>:
 
<select name="Title">
    <cfouput query="getListValues">
        <option value="#getListValues.TheListID#">#getListValues.TheListText#</option>
    </cfoutput>
</select>

Open in new window

I guess I'm just not getting it. When I run the following suggested code by itself it displays the drop down:

<cfquery name="dropdownvalues" datasource="sspsrs">
    SELECT titleid, Title_Name
    FROM IssueTitles
</cfquery>

<td><select name="dropdown">
<cfoutput query="dropdownvalues">
<option>#dropdownvalues.title_name#</option>
</cfoutput></select></td>

When I run the code above within my <cfupdate> code excerpt below I am not successful at getting an dropdown within a table row. I am getting the following error: 'The value of the attribute query, which is currently dropdownvalues, is invalid."  

Thanks in advance for bearing with me as I try to get this right.
<cfquery name="dropdownvalues" datasource="sspsrs">
    SELECT titleid, Title_Name
    FROM IssueTitles
</cfquery>


<CFOUTPUT>



<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">

<tr bgcolor="iif(currentrow MOD 1,DE('123456'))">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2><select name="dropdown"><cfoutput query="dropdownvalues"><option value="#dropdownvalues.titleid#>#dropdownvalues.title_name#</option></cfoutput></select></font></td>
<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Customer" size="25" value="#Customer#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="10" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="10" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="10" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="10" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="10" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="25" value="#Comments#"></font></td>
</tr>

</CFOUTPUT>

Open in new window

No, I think you're getting it now.  

But that error is saying the query didn't actually run.  Your main form has a lot of cfif/cfelse's in it. So I'm guessing the cfquery isn't executing at the right time.  As a test, place it at the very top of your page.  Make sure it's *not* inside a cfif/cfelse

<cfquery name="dropdownvalues" datasource="sspsrs">
    SELECT titleid, Title_Name
    FROM IssueTitles
</cfquery>

<!-- If URL.From is defined and equals DoEdit, then update the table -->
<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "DoEdit">
.... rest of code 

Open in new window

Took the last suggestion above from expert by placing the dropdownvalues cfquery at the top of the page and refreshing the page. Now i'm getting the following error message:

Invalid tag nesting configuration.
A query driven cfoutput tag is nested inside a cfoutput tag that also has a query attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing. Below is my full code for the page i'm trying to run successfully.

I continue to appreciate the help and patience you guys are providing. This is definitely a hump in my development I can't wait to get over.
<cfquery name="dropdownvalues" datasource="sspsrs">
    SELECT titleid, Title_Name
    FROM IssueTitles
</cfquery>

<!-- If URL.From is defined and equals DoEdit, then update the table -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "DoEdit">

<CFUPDATE DATASOURCE="SSPSRs" TABLENAME="Issues">

</CFIF>
</CFIF>


<!-- The below code selects all data from the table -->

<CFQUERY NAME="all" DATASOURCE="SSPSRs">
select * from Issues where user_name = <cfoutput>'#url.user_name#'</cfoutput>;
</CFQUERY>



<body>
<a href="trackertabs.cfm?user_name=<cfoutput>#url.user_name#</cfoutput>&tab=2">
<img src="http://127.0.0.1:8500/TicketTracking/pics/imagesCA6WFWX0.jpg" width=50 height=50 alt="go back to service tab" border="0" /></a> 
</body>
<br>

<body> 
<center>
<font size=6 font face="Copperplate Gothic Ligth">
My Service Requests (All)
</font>
</center>
<br>
</body>


<body>

<!-- If DoUpdate has been run a short note is given -->

<CFIF IsDefined("DoUpdate.RecordCount")>
<p><b>Thanks for your update!</b>
</CFIF>



<table border='0' width='100%' align='center' summary='script output'>

<tr bgcolor="#d3d3d3">
<th bgcolor="#d3d3d3"><font size=2><b>Service<br> Request #</b></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Request</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Network</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Assigned To</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Customer</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Opened Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Closed Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Status</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Priority</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Description</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Date Completed</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Comments</strong></font></th>
<th></th>
</tr>

<!-- Here we check for the URL.From attribute -->

<CFIF IsDefined("URL.From")>

<!-- If URL.From just equals DoEdit, we simply just output the data, just as if it was undefined  -->

<CFIF #URL.From# IS "DoEdit">



<cfoutput query="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>

<CFELSE>

<CFLOOP QUERY="all">

<CFIF #URL.ID# IS #all.Ticket_Num#>

<CFOUTPUT>

<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">

<tr bgcolor="iif(currentrow MOD 1,DE('ffffff'))">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#<select name="dropdown"><cfoutput query="dropdownvalues"><option value="#dropdownvalues.titleid#>#dropdownvalues.title_name#</option></cfoutput></select></font></td>
<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Customer" size="25" value="#Customer#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="10" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="10" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="10" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="10" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="10" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="25" value="#Comments#"></font></td>
</tr>

</CFOUTPUT>

<CFELSE>

<!-- This is where all the data get's nicely output into the table -->

<cfoutput>
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<td>
</td>
</tr>
</CFOUTPUT>

</CFIF>

</CFLOOP>

</CFIF>

<!-- If URL.From is undefined -->

<CFELSE>

<CFOUTPUT QUERY="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffff66'))#">
<td><font size=2>#Ticket_num#</font></td> 
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Customer#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>

</CFIF>

<!-- If URL.From is defined and equals Edit, then display an update button and close the form -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "Edit">

<tr>
<td colspan="3">
<CFOUTPUT>
<input type="hidden" name="Ticket_num" value="#URL.ID#">
</CFOUTPUT><br>
<br>
<br>
<input type="submit" value="Update">
</form>
</td>
</tr>

</CFIF>
</CFIF>

</table>

</body>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<input type="text" name="Title" size="25" value="#Title#">
<select name="dropdown">

By the way, the original expert named the <select> "dropdown" just as an example.  You probably want to change it back to "title" so your <cfupdate> works just like before.

ie <select name="Title">

Yes we have success! Almost over the hump! I have one small problem though. After editing a value in the tablerow and clicking the update button.... the original value does not get overwritten by the new value. So now the original value in the record and the new value are both being displayed and separated by a comma. How do I fix this. Thanks in advance.




<cfquery name="dropdownvalues" datasource="sspsrs">
    SELECT Title_Name
    FROM IssueTitles
</cfquery>

<!-- If URL.From is defined and equals DoEdit, then update the table -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "DoEdit">

<CFUPDATE DATASOURCE="SSPSRs" TABLENAME="Issues">

</CFIF>
</CFIF>


<!-- The below code selects all data from the table -->

<CFQUERY NAME="all" DATASOURCE="SSPSRs">
select * from Issues where user_name = <cfoutput>'#url.user_name#'</cfoutput>;
</CFQUERY>



<body>
<a href="trackertabs.cfm?user_name=<cfoutput>#url.user_name#</cfoutput>&tab=2">
<img src="http://127.0.0.1:8500/TicketTracking/pics/imagesCA6WFWX0.jpg" width=50 height=50 alt="go back to service tab" border="0" /></a> 
</body>
<br>

<body> 
<center>
<font size=6 font face="Copperplate Gothic Ligth">
My Service Requests (All)
</font>
</center>
<br>
</body>


<body>

<!-- If DoUpdate has been run a short note is given -->

<CFIF IsDefined("DoUpdate.RecordCount")>
<p><b>Thanks for your update!</b>
</CFIF>



<table border='0' width='100%' align='center' summary='script output'>

<tr bgcolor="#d3d3d3">
<th bgcolor="#d3d3d3"><font size=2><b>Service<br> Request #</b></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Request</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Network</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Assigned To</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Last_Name</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>First Name</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Opened Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Closed Date</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Status</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Priority</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Description</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Date Completed</strong></font></th>
<th bgcolor="#d3d3d3"><font size=2></strong>Comments</strong></font></th>
<th></th>
</tr>

<!-- Here we check for the URL.From attribute -->

<CFIF IsDefined("URL.From")>

<!-- If URL.From just equals DoEdit, we simply just output the data, just as if it was undefined  -->

<CFIF #URL.From# IS "DoEdit">

<cfoutput query="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffcc66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Last_Name#</font></td>
<td><font size=2>#First_Name#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>


<CFELSE>

<CFLOOP QUERY="all">

<CFIF #URL.ID# IS #all.Ticket_Num#>

<CFOUTPUT>



<form action="mysrs.cfm?user_name=#url.user_name#&From=DoEdit&ID=#Ticket_num#" method="post">

<tr bgcolor="iif(currentrow MOD 1,DE('123456'))">
<td><font size=2>#Ticket_num#</font></td>

<td><font size=2><input type="text" name="Title" size="25" value="#Title#">
<select name="Title">
<cfloop query="dropdownvalues">
<option>#dropdownvalues.title_name#</option>
</cfloop>
</select></font></td>

<td><font size=2><input type="text" name="Network" size="15" value="#Network#"></font></td>
<td><font size=2><input type="text" name="Assigned_To" size="25" value="#Assigned_To#"></font></td>
<td><font size=2><input type="text" name="Last_Name" size="25" value="#Last_Name#"></font></td>
<td><font size=2><input type="text" name="First_Name" size="25" value="#First_Name#"></font></td>
<td><font size=2><input type="text" name="Opened_Date" size="10" value="#DateFormat(Opened_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Closed_Date" size="10" value="#DateFormat(Closed_Date,'mm/dd/yyyy')#"></font></td>
<td><font size=2><input type="text" name="Status" size="10" value="#Status#"></font></td>
<td><font size=2><input type="text" name="Priority" size="10" value="#Priority#"></font></td>
<td><font size=2><input type="text" name="Description" size="30" value="#Description#"></font></td>
<td><font size=2><input type="text" name="Date_Completed" size="10" value="#Date_Completed#"></font></td>
<td><font size=2><input type="text" name="Comments" size="25" value="#Comments#"></font></td>
</tr>

</CFOUTPUT>

<CFELSE>

<!-- This is where all the data get's nicely output into the table -->

<cfoutput>
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffcc66'))#">
<td><font size=2>#Ticket_num#</font></td>
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Last_Name#</font></td>
<td><font size=2>#First_Name#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>
<td>
</td>
</tr>
</CFOUTPUT>

</CFIF>

</CFLOOP>

</CFIF>

<!-- If URL.From is undefined -->

<CFELSE>

<CFOUTPUT QUERY="all">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('ffcc66'))#">
<td><font size=2>#Ticket_num#</font></td> 
<td><font size=2>#Title#</font></td>
<td><font size=2>#Network#</font></td>
<td><font size=2>#Assigned_To#</font></td>
<td><font size=2>#Last_Name#</font></td>
<td><font size=2>#First_Name#</font></td>
<td><font size=2>#DateFormat(Opened_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#DateFormat(Closed_Date,'mm/dd/yyyy')#</font></td>
<td><font size=2>#Status#</font></td>
<td><font size=2>#Priority#</font></td>
<td><font size=2>#Description#</font></td>
<td><font size=2>#Date_Completed#</font></td>
<td><font size=2>#Comments#</font></td>

<!-- This is where the Edit button and form is created -->

<td>
<form action="mysrs.cfm?user_name=#url.user_name#&From=Edit&ID=#Ticket_num#" method="post">
<input type="submit" value="Edit">
</form>
</td>

</tr>
</CFOUTPUT>

</CFIF>

<!-- If URL.From is defined and equals Edit, then display an update button and close the form -->

<CFIF IsDefined("URL.From")>
<CFIF #URL.From# IS "Edit">

<tr>
<td colspan="3">
<CFOUTPUT>
<input type="hidden" name="Ticket_num" value="#URL.ID#">
</CFOUTPUT><br>
<br>
<br>
<input type="submit" value="Update">
</form>
</td>
</tr>

</CFIF>
</CFIF>

</table>

</body>

Open in new window

Oops.  Sorry that extra <input> field was a copy paste error.  Just get rid of it because you've replaced it with the <select> list:

ie Remove this
<input type="text" name="Title" size="25" value="#Title#">

All is now working the way I need it to! Appreciate you sticking with me on this one. I will definitely increase the point value for all the help. Can I throw in another quick question (laugh)?

I notice that when the edit button is clicked to edit a table row... the description field that's editable displays <div> tags before and after the description text. Why is that?
I don't see anything in the code that would cause that.  It's just plain form tags.  Any chance your possible your db record actually contains the <div> tags? Because that would explain it.
no <div> tags in any of the database records as I can see . I'm using a Microsoft Access db. The only thing I can think of is the fact that the datatype for the description field is a memo type. Not sure if that matters or not. I changed it to a text datatype and gave it a 255 field size. Added a new record and then edited on the webpage. No <div> tags for that record. I can live with that for now.

Additional question... i will increase the point value for the additional help.

I have a date field that could be edited during the cfupdate. How would I go about adding a calendar (date picker) to my edit capability? Thanks again in advance.

(Not about points I'm happy to answer any questions .. ) but it's actually better (and EE policy) to put separate/new questions on a new thread. One question per thread makes it easier for people searching to find solutions :)
fact that the datatype for the description field is a memo type.

I don't use Access much. But I don't think it should make a difference. I didn't even see any <div> tags in the code either.  Does it happen for every edit?
Just continuing on the <div> tag mystery, is there any other code in the page we can't see? Like maybe some extra javascript, etc...?
I appreciate the assistance with my question. Lots of patience and good explanations until I finally got the result I needed.