When you say "update only specific records" do you mean only the ones that
have changed?

There are two ways I can think of offhand to do something like that.

The first is to have the default in the dropdown be the empty string and
only update if the submitted form item is not the empty string (or something
along those lines).

The second is to have the default in the dropdown be the value already in
the DB by using something like
<cfif thisvalue = dbvalue>
        <option value="thisvalue" selected>#thisvalue#</option>
<cfelse>
        <option value="thisvalue">#thisvalue#</option>
</cfif>
and either updating all the values in the DB (the ones that the user doesn't
change should be the same) or running another query (or storing the results
of the first one) to check the values to see if they've changed.



  --Ben Doom
    Programmer & General Lackey
    Moonbow Software

: -----Original Message-----
: From: Les Mizzell [mailto:[EMAIL PROTECTED]]
: Sent: Friday, December 13, 2002 10:09 PM
: To: CF-Talk
: Subject: Form inside a loop problem - advise please!
:
:
: I've got a cfloop/form structure set up to allow a user to update
: one or two
: specific fields in specific records.
:
: ID of Record = #MyQuery.Record_ID#
: Data field to update = BOB
:
: The loop and form sorta like (not real code):
:
: <cfloop>
:     <form>
:       <select name="BOB_#MyQuery.Record_ID#">
:       <hidden name="RecID" value="#myQuery.Record_ID#
:         <submit>
:     </form>
: </cfloop>
:
:
: Using the following query code
:
: <cfloop index="UpdateID" list="#Form.RecID#">
:   <cfquery datasource="MyData">
:       UPDATE dbo.app_Master
:         SET BOB = '#evaluate("FORM.BOB_#UpdateID#")#',
:         WHERE MSTR_ID= '#UpdateID#'
:   </cfquery>
: </cfloop>
:
: I'm having trouble getting only the specific record to update though... it
: wants to update them all......
:
: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to