Hi, all... I've put together a page that uses ajax to add, update, preview, and delete virtual tours for real estate properties using CF and Ajax (jQuery) and a CFC.
Where I need some guidance is the part for the update. I've got the actual update working fine, but I was wondering how I should approach getting the new value for the virtual tour field back in the field on the page itself. Typically, if I were doing this only in CF, after updating the info in the db with a query, I'd re-query the db, get the new info and insert that into the field or leave the field empty based on the query results: <cfif len(trim(updateStruct.tour_url))> <input name="tour_url" value="#updateStruct.tour_url#"> <cfelse> <input name="tour_url" value=""> </cfif> Currently, I essentially did the same thing in the cfc that processes the ajax request, by updating the data, then running another query to retrieve the new data and send that back as part of a struct. However, I currently have just the one input field for updating the tour_url. (Is there a question in here? :o) Should I be focusing on an ajax solution to updating the value in the update field without using alternative inputs for different values or should I just have something like the code above to give me an alternate field that will show if an update value is present? e.g.... <cfif len(trim(initial_page_query.tour_url))> <input name="tour_url" value="#initial_page_query.tour_url#"> <cfelseif len(trim(updateStruct.tour_url))> <input name="tour_url" value="#updateStruct.tour_url#"> <cfelseif isdefined("initial_page_query.tour_url") and not len(trim("initial_page_query.tour_url"))> <input name="tour_url" value=""> <cfelseif isdefined("updateStruct.tour_url") and not len(trim("updateStruct.tour_url"))> <input name="tour_url" value=""> </cfif> Surely there's a more efficient way of using Ajax to determine the value that should go in the update field...or do I have to have all these alternative inputs? (You can see my confusion about how this part with Ajax and CF should work) Thanks for any feedback! Rick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318016 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4