You need to use AJAX.  Basically, inside your lookUpUPC() function you 
will make a call to a CFC that does the query and hands it back to the 
javascript function to pupulate fields.  Look into CFAjax. 

Jason T. Slack wrote:
> I am on Day 5 with CF and Coming along nicely.
>
> I have a question on mixing CF and Javascript.
>
> Say I have the following with an onBlur event:
>
> <input type="textfield" name="upc" id="upc" size="12" maxlength="12"  
> onblur="lookUpUPC(this.value);" />
>
> Here is the JS for LookUpUPC()
>
> function lookUpUPC(upc)
> {     
>       <cfquery name="ckUPC" datasource="#application.dsn#">
>       SELECT Description, UnitPrice FROM Inventoryitems
>            WHERE upc = <Cfqueryparam cfsqltype="cf_sql_varchar"
>       value=upc>;
>       </cfquery>
>
>       <cfif ckUPC.recordCount EQ 1>
>                       alert("UPC FOUND");
>       <cfelse>
>                       alert("UPC NOT FOUND");
>       </cfif>
> }
>
>
> When LookUpUPC fires I get just the alert boxes that I coded in for  
> information purposes. I tried hard coding the query with a valid upc  
> in the database and still I get UPC not found.
>
> So I must be doing something wrong but I am not sure what.
>
> Can anybody shed some light?
>
> -Jason
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260372
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to