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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Multiple Records

Status
Not open for further replies.

sue0912

MIS
Jun 19, 2007
50
0
0
US
Hi,

I have the following form which updates multiple records. I am having a problem with the last field which is a drop down. The other fields update but not the drop down.

Can someone tell me what I did wrong?

FORM
<cfquery name = "getproducts" datasource="intranet">
SELECT *
FROM InventoryUsed
WHERE ProjectID = '#ProjectID#' AND TaskID = '#TaskID#'
Order BY PartID
</cfquery>

<form method="post" action="process_updateparts.cfm">

<table>
<tr>
<TH width="16%" NOWRAP CLASS="title"><FONT CLASS="ColumnFont"><FONT COLOR="444444">Item</FONT></FONT></TH>
<TH width="18%" NOWRAP CLASS="title"><FONT CLASS="ColumnFont"><FONT COLOR="444444">Description</FONT></FONT></TH>
<TH width="29%" NOWRAP CLASS="title"><FONT CLASS="ColumnFont"><FONT COLOR="444444">Status</FONT></FONT></TH>
</tr>

<cfoutput query="getproducts">
<tr>
<td>#partName#</td>
<td><input name="partdescription_#partid#" type="text" value="#partdescription#" size="15"></td>
<td><input name="qty_#partid#" type="text" value="#qty#" size="15"></td>
<td>
<select name="status_#partid#">
<option value="#status#"<cfif Status IS "BackOrdered"> selected </cfif>>BackOrdered</option>
<option value="#status#"<cfif Status IS "DropShipped"> selected </cfif>>DropShipped</option>
<option value="#status#"<cfif Status IS "FAB-ACS"> selected </cfif>>FAB-ACS</option>
<option value="#status#"<cfif Status IS "New"> selected </cfif>>New</option>
<option value="#status#"<cfif Status IS "Ordered"> selected </cfif>>Ordered</option>
<option value="#status#"<cfif Status IS "Completed"> selected </cfif>>Completed</option>
<option value="#status#"<cfif Status IS "Cancelled"> selected </cfif>>Cancelled</option>
<option value="#status#"<cfif Status IS "On Hold"> selected </cfif>>On Hold</option>
<option value="#status#"<cfif Status IS "Issued"> selected </cfif>>Issued</option>
<option value="#status#"<cfif Status IS "Requisitioned"> selected </cfif>>Requisitioned</option>
<option value="#status#"<cfif Status IS "Staged"> selected </cfif>>Staged</option>
<option value="#status#"<cfif Status IS "Shipped"> selected </cfif>>Shipped</option>
<option value="#status#"<cfif Status IS "Truck Stock"> selected </cfif>>Truck Stock</option>
<option value="#status#"<cfif Status IS "MPT"> selected </cfif>>MPT</option>
</select>
</td>
</tr>
</cfoutput>

<tr>
<td colspan="5"><input type="submit" name="Submit" value="Submit"></td>
</tr>

</table>

<cfoutput>
<input type="hidden" name="listofids" value="#ValueList(getproducts.partid)#">
</cfoutput>

</form>

Processing Page/Code
<cfloop index="partid" list="#form.listofids#" delimiters=",">
<cfquery datasource="intranet">
UPDATE inventoryused SET
partdescription = '#Evaluate("form.partdescription_#partid#")#',
qty = '#Evaluate("form.qty_#partid#")#',
status = '#Evaluate("form.status_#partid#")#'
WHERE partid=#partid#
</cfquery>
</cfloop>

Thanks
Sue
 
Never mind. I see what I did...

on the form, instead of this

<option value="#status#"<cfif Status IS "BackOrdered"> selected </cfif>>BackOrdered</option>

it should have been..
<option value="BackOrdered"<cfif Status IS "BackOrdered"> selected </cfif>>BackOrdered</option>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top