Thanks - Will take a look at it and evaluate how it compares with doing
it with ASP.net webforms or ASP.net MVC2 as its going to be a learning
curve whatever language I do it in, I suppose I'm leaning toward ASP as
this has a greater lifespan compared to CF.

The reason of my asking in CF was if it was relatively easy to do I
would have gone that route but if there is a similar learning curve to
do it in VB then this would be a more scaleable and supported path



-----Original Message-----
From: Steve 'Cutter' Blades [mailto:cold.fus...@cutterscrossing.com] 
Sent: 02 March 2011 16:01
To: cf-talk
Subject: Re: Database Lookup - Possible with CF?


Here is a brief tutorial on writing a CFC (Google is your friend) 
http://www.learn-coldfusion-tutorial.com/ColdFusion-Components.cfm

You would put your query in a method in the CFC.

You would use the success handler of your ajax call to populate the 
form. This will take some further research on your part.

Steve 'Cutter' Blades
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer
____________
http://blog.cutterscrossing.com


Co-Author "Learning Ext JS 3.2" Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-deskto
p-style-user-interfaces/book

"The best way to predict the future is to help create it"


On 3/2/2011 9:30 AM, Ian Vaughan wrote:
> Hi Craig et al
>
> Thanks for this
>
> So download JQuery and link to the file on your server
>
> Does it have to be a CFC?  Its just that I have never used them before
-
> where would your SQL go in the CFC and would it be the same as a cfm
> page
>
> i.e.
> <cfquery>  select * from emptable where employeenumber =
> #form.employeenumber#</cfquery>
>
>
> Then after you have queried the database - how would you populate the
> form fields on the fly with the data you extracted from the database
> based on what employee number had been entered
>
> For example I take it that
> <cfinput type="text" id="empname"  name="empname"
> value="#queryperson.empname#" .....
>
>
> Would not work?
>
>
> -----Original Message-----
> From: Craig Rosenblum [mailto:crosenb...@gmail.com]
> Sent: 02 March 2011 14:50
> To: cf-talk
> Subject: Re: Database Lookup - Possible with CF?
>
>
> Basically the easiest way to do ajax, is the following...
>
> 1. download jquery libraries, or in your source code refer to
different
> hosting of the jquery libraries. jquery fyi, is javascript libraries,
> that work cross-browser and make it easier to do things like ajax, and
> millions of other things.
>
> 2. Read this and any other article,
>
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-ca
> lls-with-jquery/ to get a handle on how to use jquery.
>
> 3. create a cfc, that can send/receive data you want.
>
> Yes this is a lot to learn, if you've never played with ajax or jquery
> before. So I will show you some example code.
>
> You can either download a copy of the jquery libraries, or refer to a
> cdn hosted copy on google or jquery.com, or a few other sites hosting
> jquery libraries for public use.
>
> Then you need to create a cfc, which is basically like a coldfusion
> normal template, except it has functions, instead of normal page
logic.
>
> A cfc will be like this structure
>
> cfcomponent
>
> cffunction name="somename" access="remote" output="true"
> cfargument name=company_id type=integer required=true
>
> do some stuff
>
> /cffunction
>
> /cfcomponent
>
> That's a very basic cfc, must be saved as a cfc extension.
>
> The 1st key part is making the cfc file in a web-accessible url
folder.
>
> Then you have to create ajax that will send the parameters it needs to
> do whatever functioning you need to do.
>
> I hope this get's you a good starting point....
>
>
>> Hi
>>
>> We are on CF7, not sure if this restricts the amount of functionality
>> available to me?
>>
>> So how would it work - when a user types in their employee number in
> the
>> text field how would ajax call a SQL query to lookup the data in the
db
>> table to populate the rest of the fields in the form.
>>
>> Do you have any code examples, as I am struggling to grasp how to
>> implement this at the moment?
>>
>> Many Thanks
>>
>> It is definitely possible and rather easy using CF (or just plain
>> javascript) - all you need to do is make an ajax request to a cfc/cfm
> on
>> your server passing entered employee number as data/argument, which
> will
>> return necessary data based on emp number. You then populate
necessary
>> fields with returned data.
>> CF's built-in ajax functionality will come in handy here (i.e.
cfinput
>> fields with bind attribute pointing to your cfc method), but not
>> required - same is easily achieved with a regular js ajax request;
>> jQuery will even make it fun.
>> If you are not very familiar with javascript, and you are running
CF8+,
>> then use the built-in cf functionality. All you need is well
described
>> in CF Developer's Guide (download pdf from adobe.com) and numerous
>> blogs.
>>
>> Azadi
>>
>> On 02/03/2011 17:37 , Ian Vaughan wrote:
>> the
>>> corner of Coldfusion - so if I can deliver this app in Coldfusion it
>>> would certainly help it's case so it would still be a viable
>> development
>>> option here.
>>>
>>> Many Thanks
>>>
>>>
>>>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:342712
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to