House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

need function available for ColdFusion and JS

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Daniel Kessler
06/07/2004 11:28 AM

I have a cold fusion function that is used by other CF functions. I've found that a JS function now needs it.  Should I just duplicate it for JS or can it use the CF function?  I'd hate to dup it cause it's the only place where a  js function needs it. thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD  20742-2611 301-405-2545 Phone www.phi.umd.edu

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
06/07/2004 11:34 AM

> I have a cold fusion function that is used by other CF > functions. I've found that a JS function now needs it.   > Should I just duplicate it for JS or can it use the CF > function? I'd hate to dup it cause it's the only place > where a  js function needs it. Client-side JavaScript run within a browser cannot directly invoke a function written in CF. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ phone: 202-797-5496 fax: 202-797-5444

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
daniel kessler
06/07/2004 11:42 AM

>Client-side JavaScript run within a browser cannot directly invoke a >function written in CF. ah that makes total sense, said that way : ) And can I guess that the server-side CF, won't call a client-side JS function?  I guess I can validate this form in CF, but I'd still like to have the JS alerts rather than go to another page, just to say "hey fill in the header, guy!".

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Guy Rish
06/07/2004 11:57 AM

Daniel, You will need to duplicate the functionality.  CFML functions only execute on the server - building the page.  JavaScript functions run in the browser once the page is built and sent to the client. Now depending upon your needs you can use CFML to build your JS function... rish I have a cold fusion function that is used by other CF functions. I've found that a JS function now needs it.  Should I just duplicate it for JS or can it use the CF function?  I'd hate to dup it cause it's the only place where a  js function needs it. thanks. -- Daniel Kessler Department of Public and Community Health University of Maryland Suite 2387 Valley Drive College Park, MD  20742-2611 301-405-2545 Phone www.phi.umd.edu

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Pascal Peters
06/07/2004 11:58 AM

You can't use a CF function in JS. Different syntax!!!! You have to duplicate it (and adapt it to JS). Pascal ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
daniel kessler
06/07/2004 12:32 PM

>You can't use a CF function in JS. Different syntax!!!! You have to >duplicate it (and adapt it to JS). that's not exactly what I meant.  I meant to call the js function from cf, but others have told me that this isn't doable or practicle.  Really I just wanted the js alerts. Still, duplicating the cf function in js is almost a drop'n'play.  Since it's written in an ecma like script, all I really need to do is to change the EQ to == (and such) and adjust the names of any api calls - createDateTime() becomes Date(). thanks for answering Pascal, Dave and everyone.

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Whittingham, P
06/07/2004 12:39 PM

do you mean this. Pat <cfoutput> function new_fnc() { ......more javascript code . ... .... alert('#cf_variable#'); return true; } // end of new_fnc..... </cfoutput> >You can't use a CF function in JS. Different syntax!!!! You have to >duplicate it (and adapt it to JS). that's not exactly what I meant.  I meant to call the js function from cf, but others have told me that this isn't doable or practicle.  Really I just wanted the js alerts. Still, duplicating the cf function in js is almost a drop'n'play.  Since it's written in an ecma like script, all I really need to do is to change the EQ to == (and such) and adjust the names of any api calls - createDateTime() becomes Date(). thanks for answering Pascal, Dave and everyone.   _____  

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
daniel kessler
06/07/2004 04:49 PM

No, I don't want to write out a js function, just call one that's already there.   But that's ok.  I'll just use a different implementation.  I thought of it as a solution and tried to determine how practical it was, which it wasn't.  Shame though, it's nice, easy gui to put up an alert. ----- Excess quoted text cut - see Original Post for more -----    > _____  

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
06/07/2004 12:47 PM

> And can I guess that the server-side CF, won't call a > client-side JS function?   That's correct. > I guess I can validate this form in CF, but I'd still like > to have the JS alerts rather than go to another page, just > to say "hey fill in the header, guy!". It sounds to me like you want to have JavaScript form validation for user-friendliness and convenience, and server-side form validation for security and robustness. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ phone: 202-797-5496 fax: 202-797-5444


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

February 08, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29