Here's a simple bit that just set's the fields using the array returned
for first and last names and outputs the password by replacing the div's
innerHTML.
<cfinclude template="/scripts/cfajax/core/cfajax.cfm">
<cffunction name="netIDLookup" hint="type='keyvalue' jsreturn='array'">
<cfargument name="netID" required="yes" type="string">
<cftry>
<cfquery name="getPerson" datasource="#request.dsn#">
SELECT * FROM user
WHERE ID = '#netID#'
</cfquery>
<cfset user = ArrayNew(1)>
<cfif getPerson.recordcount gt 0>
<cfset arrayAppend(user,"firname,#getPerson.first_name#")>
<cfset arrayAppend(user,"lastname,#getPerson.last_name#")>
<cfset arrayAppend(user,"password,#getPerson.password#")>
<cfelse>
<cfset arrayAppend(user,"Network ID not found.")>
<cfset arrayAppend(user,"Please try again")>
<cfset arrayAppend(user," ")>
</cfif>
<cfcatch type="Any">
<cfset error = ArrayNew(1)>
<cfset arrayAppend(error, "error occurred in function")>
<cfreturn error>
</cfcatch>
</cftry>
<cfreturn user>
</cffunction>
<script type='text/javascript' src='/ajax/core/engine.js'></script>
<script type='text/javascript' src='/ajax/core/util.js'></script>
<script type='text/javascript' src='/ajax/core/settings.js'></script>
<script language="javascript">
_cfscriptLocation = "http://localhost/test.cfm";
function getName(){
var netID = DWRUtil.getValue("userID");
//alert(netID);
DWREngine._execute( _cfscriptLocation, null, 'netIDLookup',
netID,getUserInfo);
}
function getUserInfo(user){
DWRUtil.setValue("firstname", user[0].VALUE);
DWRUtil.setValue("lastname", user[1].VALUE);
document.getElementById("pass").innerHTML = user[2].VALUE;
}
function init(){
DWRUtil.useLoadingMessage();
DWREngine._errorHandler = errorHandler;
}
</script>
<cfoutput>
<body onload="init();">
<form name="test" action="">
<input type="text" value="3" name="userID" id="userID">
<input type="button" onclick="getName();"><br>
Fname:<input type="text" value="" name="firstname"
id="firstname"><br>
Lname:<input type="text" value="" name="lastname" id="lastname"><br>
</form>
<div id="pass"> </div>
</body>
</cfoutput>
Andy Matthews wrote:
>Got any real world sample code to go with it?
>
>:)
>
><!----------------//------
>andy matthews
>web developer
>ICGLink, Inc.
>[EMAIL PROTECTED]
>615.370.1530 x737
>--------------//--------->
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221203
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54