Reputation:
Having a little problem here. I'm working on a project and a client needs the functionality to be able to update/chose to publish reviews from their control panel to their live site.
I've got the code deleting records from the database just fine, but I'm having trouble targeting the specific text area from the dynamically populated list (I hope that makes sense).
I'm setting the ID of the text area to the ReviewID in the database, so that the right record would be updated on submit. This is the code I have set up on the textarea
<textarea rows="5" style="width: 800px;" id="
<cfloop query='rsGetName'>
<cfif #rsGetTestimonials.ClientID# EQ #rsGetName.ClientID#>
#rsGetTestimonials.ReviewID#
</cfif>
</cfloop>">
#rsGetTestimonials.cTestimonial#
</textarea>
So the ID of the text area is a dynamic integer.
How do I target this so that it updates the right record in the database? My submit button looks like this -
<a href="testimonials-view.cfm?rID=#ReviewID#" title="Update this testimonial">
<img src="images/buttonSaveContinue.gif" border="0" />
</a>
so it posts back to the same page and appends the Review ID on the end of the URL, which I'm trying to use to get it to update the right database record.
My update query looks like this. The logic of what I'm trying to do is pretty evident in this.
<cfif IsDefined('URL.rID')>
<cfquery datasource="#Request.dsn#">
UPDATE clientreview
SET cTestimonial = #FORM.rsGetTestimonials.ReviewID#
WHERE
ReviewID = #URL.rID#
</cfquery>
</cfif>
Any help on this one would be greatly appreciated!
If this doesn't make as much sense as I hope it does, then let me know and I'll try to explain a little more.
Thanks, Josh
Upvotes: 1
Views: 514
Reputation: 4748
I think the problem lies in that your not naming the text area, give it a fixed or dynamic name then reference that name in your update.
Upvotes: 3