Jason,
ColdFusion cannot be directly invoked from JavaScript without a interface to
call a service.
ColdFusion is processed and then the end result is passed through the web
server to your browser. At that point essentially, the page is static.
If you want interactivity, you have to call another page or service to
activate CF enabled templates. This is typically done in AJAX when using
JavaScript. You can do this also in Flash with Flex.
Teddy
On 11/14/06, Jason T. Slack <[EMAIL PROTECTED]> 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:260378
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4