Ian, Now you are sort of asking for us to define your functional spec. Getting your data from a web service is a completely new discussion. Yes it's possible with CF 7 - but what sort of web server? What are the methods? What get's returned? There could be dozens of answers to this question. It is simply too broad. Investigate web services using WSDL - or possibly your web service is a REST type interface, where the data is returned from a POST request as XML and you parse through it. Either way there's a whole slew of possibilities, obstacles and challenges that come with this part of your process. If you want help start experimenting and give us specific examples of errors or hurdles you are trying to overcome.
-Mark -----Original Message----- From: Ian Vaughan [mailto:i.vaug...@neath-porttalbot.gov.uk] Sent: Friday, March 11, 2011 4:02 AM To: cf-talk Subject: RE: Database Lookup - Possible with CF? Thanks all. The data is going to coming from a web service not a database, what steps in CF7 do I need to follow to consume an external web service and populate the form fields accordingly based on employeeid - is it the same process as below? -----Original Message----- From: Dean Lawrence [mailto:dean...@gmail.com] Sent: 10 March 2011 15:04 To: cf-talk Subject: Re: Database Lookup - Possible with CF? Ian, I think your a little confused about a couple of things. First off, AJAX really has no direct relationship with ColdFusion. AJAX runs on the client side and ColdFusion runs on the server side. AJAX simply allows your browser to make additional HTTP requests via JavaScript instead of having to leave the initial page request. Those additional HTTP requests could be to a ColdFusion page (.cfc or .cfm), to an Asp.Net page, or to a .php page, it doesn't really matter. You can read about how to make an AJAX call using jQuery at http://api.jquery.com/category/ajax/ When you make the AJAX call to a processing page (in this case your CFC), you will want to return JSON data so that jQuery can then use it to populate your form fields. Once the data has been returned to jQuery, the server is out of the picture, you will be using jQuery to then use the data to populate the fields, not ColdFusion (or any other server side language for that matter). Here is a simple example of how to step through the returned JSON data to populate a form http://stackoverflow.com/questions/635565/walk-json-response-and-populate-fo rm-fields-more-efficient-approach. You will notice that in this thread, they are using .php to return the JSON data. Back to your CFC. When you make the AJAX call to your CFC, you will want to return JSON data to jQuery. CF 7 doesn't have any built-in functions to do this. However, here are two different projects that you can use to convert the query data. http://www.epiphantastic.com/cfjson/index.php http://jsonutil.riaforge.org/ Both of these project will convert native ColdFusion objects into JSON data, so you could pass them a query, structure, or array and they will do the conversion. So in your CFC, you would then return the converted string, not the original query object. Hopefully, this clears things up for you and will get you on the right path. Dean On Thu, Mar 10, 2011 at 4:51 AM, Ian Vaughan <i.vaug...@neath-porttalbot.gov.uk> wrote: > > Hi Steve > > So my CFC would be like this? > > <cfcomponent displayname="Employee" hint="ColdFusion Component for > getting Employee ID"> > <!--- This function retrieves employee info from the database ---> > > <cffunction name="retrieveEmployees" hint="Gets employee info from the > database" returntype="query"> > <cfquery name="getEmp" datasource=#APPLICATION.dsn#> > select * from employees > where > form.empid = getEmp.empid > </cfquery> > <cfreturn getEmployees> > </cffunction> > </cfcomponent> > > How would I then use a AJAX/Json call to populate the remaining form > fields from the query in the above CFC? And how does AJAX call the CFC > on Coldfusion 7? > -- --------------------------------------------------------------------------- Dean M. Lawrence INTERNET DATA TECHNOLOGY p // 888.438.4381 ext. 701 w // www.idatatech.com f // www.facebook.com/idatatech t // www.twitter.com/idatatech Social Marketing | SEO | Design | Inter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342919 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm