Skip to main content
Inspiring
September 2, 2008
Question

Javascript and CF

  • September 2, 2008
  • 1 reply
  • 280 views
I get javascript code off the net, and sometimes it is written for me, to incorporate into the cf applicaton.

Sometimes, in the form statement, onClick ="return functionname() - or functionname(this)" is used, sometimes it is onSubmit.

Other times, the onClick and/or onSubmit is used in the input type="submit" button, other times the type is defined as a button and the submit part is called in the javascript.

What is the proper way to call javascript from coldfusion ?
    This topic has been closed for replies.

    1 reply

    Inspiring
    September 2, 2008
    there is no "proper way" to "call javascript from coldfusion": cf runs
    on the server and is totally oblivious to your client-side javascript.

    how you write and call your js functions depends solely on the purpose
    of the function and where (which html element in your page or which
    other js function) it is called from.

    just one thing to keep in mind if you are using cf8 ajax features:
    declare your in-page js functions as functionname = function() [instead
    of function functionname()], or use external js scripts and declare them
    any way you want.

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/