|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
need function available for ColdFusion and JS
I have a cold fusion function that is used by other CF functions.Daniel Kessler 06/07/04 11:28 A > I have a cold fusion function that is used by other CFDave Watts 06/07/04 11:34 A >Client-side JavaScript run within a browser cannot directly invoke adaniel kessler 06/07/04 11:42 A Daniel,Guy Rish 06/07/04 11:57 A You can't use a CF function in JS. Different syntax!!!! You have toPascal Peters 06/07/04 11:58 A >You can't use a CF function in JS. Different syntax!!!! You have todaniel kessler 06/07/04 12:32 P do you mean this.Whittingham, P 06/07/04 12:39 P > And can I guess that the server-side CF, won't call aDave Watts 06/07/04 12:47 P 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 > 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 >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!". 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 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 ----- >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. 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. _____ 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 ----- > _____ > 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
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||