Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
June Macleod #1
library functions
I am just getting started with Coldfusion and am currently using Coldfusion
MX 6.1.
I have read that you can store functions in a seperate page and call them
from within your site.
To this end I have a field on my Test2.cmf page that reads:
<input name="txtUsername" type="text"
onKeyDown="changeDetails('mytestform','hasChangedF lag')" value=
"<cfoutput>#getRisk.Risk#</cfoutput>"
and on a seperate page FunctionLibrary.cfm which is on the same site as my
Test2.cmf page I have:
<script language="JavaScript">
function changeDetails(Formname, Fieldname){
eval("document." + Formname + "." + Fieldname + ".value='1'");
eval("document." + Formname + ".Submit.disabled=false");
alert("You are here");
}
</script>
When I try to run it I get an error 'Object Expected' for the line that
calls the function. If I move the function into Test2.cmf it all works
fine.
Is there any special method by which i include a reference to the
FunctionLibrary.cfm from the Test2.cmf page? Can anyone think of a reason
why it should not work?
Many thanks
Neme
June Macleod Guest
-
constructor in dynamicly loaded library containing user defined functions not run when loading from mysql?
Hi, I've been writing a user defined function with a very expensive initialisation which only needs to run once. I thought it might be possible... -
Cannot instantiate .NET Class Library to expose webservice client library
Now that I have got the mickey mouse .NET interop problem sorted (exposing ..NET library to ASP/VB6), I want to demo the real problem I am having. ... -
#10743 [Com]: class functions & PHP core functions inconsistently clash ;)
ID: 10743 Comment by: destes at ix dot netcom dot com Reported By: jjones at net-conex dot com Status: Open... -
~/Library/ vs ~/System/Library vs /User/Library/
In article <110720031327074895%justin.c@se.net>, justin <justin.c@se.net> wrote: First off, you're a little bit confused. ~ means your home... -
[XFree86] system can't find library ( strange library behaviour )
Hi Mark, No I hadn't tried ldconfig, but it sorted out the problem, thanks! I'd read a little bit about libraries a while ago, but could not... -
Dan Bracuk #2
Re: library functions
On your test2.cfm page, do you have anything resembling
<script language="javascript> src="FunctionLibrary.cfm"> ?
Originally posted by: Newsgroup User
I am just getting started with Coldfusion and am currently using Coldfusion
MX 6.1.
I have read that you can store functions in a seperate page and call them
from within your site.
To this end I have a field on my Test2.cmf page that reads:
<input name="txtUsername" type="text"
onKeyDown="changeDetails('mytestform','hasChangedF lag')" value=
"<cfoutput>#getRisk.Risk#</cfoutput>"
and on a seperate page FunctionLibrary.cfm which is on the same site as my
Test2.cmf page I have:
<script language="JavaScript">
function changeDetails(Formname, Fieldname){
eval("document." + Formname + "." + Fieldname + ".value='1'");
eval("document." + Formname + ".Submit.disabled=false");
alert("You are here");
}
</script>
When I try to run it I get an error 'Object Expected' for the line that
calls the function. If I move the function into Test2.cmf it all works
fine.
Is there any special method by which i include a reference to the
FunctionLibrary.cfm from the Test2.cmf page? Can anyone think of a reason
why it should not work?
Many thanks
Neme
Dan Bracuk Guest
-
June Macleod #3
Re: library functions
I had the language part but not the src part.
<script language="JavaScript" src="/functionlibrary.cfm">
I have now added that in but am still getting the same error. Any other
thoughts?
June
"Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
news:dk7s7c$g26$1@forums.macromedia.com...Coldfusion> On your test2.cfm page, do you have anything resembling
> <script language="javascript> src="FunctionLibrary.cfm"> ?
>
> Originally posted by: Newsgroup User
> I am just getting started with Coldfusion and am currently usingmy> MX 6.1.
>
> I have read that you can store functions in a seperate page and call them
> from within your site.
>
> To this end I have a field on my Test2.cmf page that reads:
>
> <input name="txtUsername" type="text"
> onKeyDown="changeDetails('mytestform','hasChangedF lag')" value=
> "<cfoutput>#getRisk.Risk#</cfoutput>"
>
>
> and on a seperate page FunctionLibrary.cfm which is on the same site asreason> Test2.cmf page I have:
>
> <script language="JavaScript">
> function changeDetails(Formname, Fieldname){
> eval("document." + Formname + "." + Fieldname + ".value='1'");
> eval("document." + Formname + ".Submit.disabled=false");
> alert("You are here");
>
> }
> </script>
>
> When I try to run it I get an error 'Object Expected' for the line that
> calls the function. If I move the function into Test2.cmf it all works
> fine.
>
> Is there any special method by which i include a reference to the
> FunctionLibrary.cfm from the Test2.cmf page? Can anyone think of a> why it should not work?
>
> Many thanks
>
> Neme
>
>
>
>
>
>
June Macleod Guest
-
Dan Bracuk #4
Re: library functions
Is functionlibrary.cfm in the root directory? If not, why do you have a
forward slash in front of it?
Originally posted by: Newsgroup User
I had the language part but not the src part.
<script language="JavaScript" src="/functionlibrary.cfm">
I have now added that in but am still getting the same error. Any other
thoughts?
Dan Bracuk Guest
-
June Macleod #5
Re: library functions
My site is at D:\CFusionMX\wwwroot\Riskmax and the functionlibrary.cfm is in
that folder, as is the Test2.cfm which calls it.
I have tried setting the src= with and without the slash but the 'Object
Expected' error continues to appear.
"Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
news:dk8032$li0$1@forums.macromedia.com...> Is functionlibrary.cfm in the root directory? If not, why do you have a
> forward slash in front of it?
>
> Originally posted by: Newsgroup User
> I had the language part but not the src part.
> <script language="JavaScript" src="/functionlibrary.cfm">
>
> I have now added that in but am still getting the same error. Any other
> thoughts?
>
>
>
>
>
June Macleod Guest
-
johnab #6
Re: library functions
I have read that you can store functions in a seperate page and call them
I think you've gotten a bit confused here.
Your code is using JAvascript functions, what you probably read was refering
to either UDF (user defined functions) written in ColdFusion or possible CFCs,
Cold Fusion Components - more likely the first
Using Javascript in an external file is no difference with CF that it is with
HTML, ASP etc - the file providing the javascript is included using
<javascript...> etc in the head of the file to use it. What you'll need to be
using is code like;
If it we me, I'd rename functionlibrary.cfm to functionlibrary.js to
distinguish it from files providing ColdFusion functions as opposed to
Javascript
johnab Guest



Reply With Quote

