RE: Calling functions with cfoutput
Yeah...I find I can get tremendous leverage by creating "display methods"...such as if you have a Person object (cfc), you can have a method displayAsTableRow, displayAsDiv, displayFormDetail etc. You can really limit code repetition this way. -- Josh -Original Message- From: Dave Watts [mailto:dwa...@figleaf.com] Sent: Thursday, January 15, 2009 6:18 AM To: cf-talk Subject: Re: Calling functions with cfoutput > Custom tags, cfmodule and cfinclude all exist for good reason, they > are designed for modularising output. If you fully understand their > use, you most likely would not desire to use a function to modularise > your output though, of course, you are perfectly free to do so. > > While you are free to do what you will in any language, learning > established practice is far from trivial or ridiculous. Things are > usually done for good reason. It is a mistake to confuse conventions, no matter how common they are or how widely they're shared, with best practices. There is nothing inherently wrong with generating output from within a CFFUNCTION, and it has an OUTPUT attribute for exactly this reason. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317996 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Calling functions with cfoutput
No, there is nothing inheritently wrong with it (though there are articled reasons for not doing it: http://www.adobe.com/devnet/coldfusion/extreme/bforta_cfc.html). I don't think there are any good reasons for doing it over using modules/includes/custom tags either. But anyways, the OP seemed to be having trouble with a simple problem and the language used (ie. "not getting printed to the form") suggested that perhaps he had come from another coding language and was not aware of the other options, hence my hint. I may be wrong in those assumptions but being aware of standard practice is no irrelevent thing. Dominic ps. I am not confused with best practice / convention! :p 2009/1/15 Dave Watts : >> Custom tags, cfmodule and cfinclude all exist for good reason, they >> are designed for modularising output. If you fully understand their >> use, you most likely would not desire to use a function to modularise >> your output though, of course, you are perfectly free to do so. >> >> While you are free to do what you will in any language, learning >> established practice is far from trivial or ridiculous. Things are >> usually done for good reason. > > It is a mistake to confuse conventions, no matter how common they are > or how widely they're shared, with best practices. There is nothing > inherently wrong with generating output from within a CFFUNCTION, and > it has an OUTPUT attribute for exactly this reason. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > > Fig Leaf Software provides the highest caliber vendor-authorized > instruction at our training centers in Washington DC, Atlanta, > Chicago, Baltimore, Northern Virginia, or on-site at your location. > Visit http://training.figleaf.com/ for more information! > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317995 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Calling functions with cfoutput
> Custom tags, cfmodule and cfinclude all exist for good reason, they > are designed for modularising output. If you fully understand their > use, you most likely would not desire to use a function to modularise > your output though, of course, you are perfectly free to do so. > > While you are free to do what you will in any language, learning > established practice is far from trivial or ridiculous. Things are > usually done for good reason. It is a mistake to confuse conventions, no matter how common they are or how widely they're shared, with best practices. There is nothing inherently wrong with generating output from within a CFFUNCTION, and it has an OUTPUT attribute for exactly this reason. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317993 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Calling functions with cfoutput
Custom tags, cfmodule and cfinclude all exist for good reason, they are designed for modularising output. If you fully understand their use, you most likely would not desire to use a function to modularise your output though, of course, you are perfectly free to do so. While you are free to do what you will in any language, learning established practice is far from trivial or ridiculous. Things are usually done for good reason. Dominic 2009/1/15 Gaulin, Mark : > I just have to comment... Saying that "using a function to output isn't > really the done thing in CF" is ridiculous... The CF language has many > features and, used appropriately, they can all be used for just about > anything in a safe, consistent, and understandable way. Good designs do > not have to be constrained by trivially simply rules like that one. > > That said, good designs also follow guides such as using naming > conventions, encapsulation, separation of concerns, use of inheritance > where appropriate, etc. These are the practices that people should > strive to improve. > > Thanks >Mark > > -Original Message- > From: Dominic Watson [mailto:watson.domi...@googlemail.com] > Sent: Wednesday, January 14, 2009 5:50 PM > To: cf-talk > Subject: Re: Calling functions with cfoutput > > Using a function to output isn't really the done thing in CF. Use either > a custom tag, module include or plain cfinclude to modularise your > output logic. If the function performs some action on a string and you > want it output, you should do something like: > > > . > > > > > . > #myFunction()# > > > HTH > > Dominic > > 2009/1/14 Gerald Guido : >> Is it getting rendered out side the cfform? >> >> >> On Wed, Jan 14, 2009 at 12:16 PM, Damayanti Gupta > wrote: >> >>> I have a cfform. From this I call a function, which has cfoutput tags > >>> to output text. However this text is not getting printed to the form. > >>> Is this expected? Is there a way around this? >>> Thanks >>> NG >>> >>> e.g. >>> >>> >>> This is a form >>> >>> >>> >>> >>> This is data to be printed >>> >>> STATEMENT OF CONFIDENTIALITY: >>> The information contained in this electronic message and any >>> attachments to this message are intended for the exclusive use of the > >>> addressee(s) and may contain confidential or privileged information. >>> If you are not the intended recipient, or the person responsible for >>> delivering the e-mail to the intended recipient, be advised you have >>> received this message in error and that any use, dissemination, >>> forwarding, printing, or copying is strictly prohibited. Please >>> notify Archemix Corp. immediately at either (617) 621-7700 or by >>> return fax at (617) 621-9300 and destroy all copies of this message > and any attachments. >>> >>> >>> >> >> > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317992 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Calling functions with cfoutput
I just have to comment... Saying that "using a function to output isn't really the done thing in CF" is ridiculous... The CF language has many features and, used appropriately, they can all be used for just about anything in a safe, consistent, and understandable way. Good designs do not have to be constrained by trivially simply rules like that one. That said, good designs also follow guides such as using naming conventions, encapsulation, separation of concerns, use of inheritance where appropriate, etc. These are the practices that people should strive to improve. Thanks Mark -Original Message- From: Dominic Watson [mailto:watson.domi...@googlemail.com] Sent: Wednesday, January 14, 2009 5:50 PM To: cf-talk Subject: Re: Calling functions with cfoutput Using a function to output isn't really the done thing in CF. Use either a custom tag, module include or plain cfinclude to modularise your output logic. If the function performs some action on a string and you want it output, you should do something like: . . #myFunction()# HTH Dominic 2009/1/14 Gerald Guido : > Is it getting rendered out side the cfform? > > > On Wed, Jan 14, 2009 at 12:16 PM, Damayanti Gupta wrote: > >> I have a cfform. From this I call a function, which has cfoutput tags >> to output text. However this text is not getting printed to the form. >> Is this expected? Is there a way around this? >> Thanks >> NG >> >> e.g. >> >> >> This is a form >> >> >> >> >> This is data to be printed >> >> STATEMENT OF CONFIDENTIALITY: >> The information contained in this electronic message and any >> attachments to this message are intended for the exclusive use of the >> addressee(s) and may contain confidential or privileged information. >> If you are not the intended recipient, or the person responsible for >> delivering the e-mail to the intended recipient, be advised you have >> received this message in error and that any use, dissemination, >> forwarding, printing, or copying is strictly prohibited. Please >> notify Archemix Corp. immediately at either (617) 621-7700 or by >> return fax at (617) 621-9300 and destroy all copies of this message and any attachments. >> >> >> > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317990 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Calling functions with cfoutput
Using a function to output isn't really the done thing in CF. Use either a custom tag, module include or plain cfinclude to modularise your output logic. If the function performs some action on a string and you want it output, you should do something like: #myFunction()# HTH Dominic 2009/1/14 Gerald Guido : > Is it getting rendered out side the cfform? > > > On Wed, Jan 14, 2009 at 12:16 PM, Damayanti Gupta wrote: > >> I have a cfform. From this I call a function, which has cfoutput tags to >> output text. However this text is not getting printed to the form. Is this >> expected? Is there a way around this? >> Thanks >> NG >> >> e.g. >> >> >> This is a form >> >> >> >> >> This is data to be printed >> >> >> STATEMENT OF CONFIDENTIALITY: >> The information contained in this electronic message and any attachments to >> this message are intended for the exclusive use of the addressee(s) and may >> contain confidential or privileged information. If you are not the intended >> recipient, or the person responsible for delivering the e-mail to the >> intended recipient, be advised you have received this message in error and >> that any use, dissemination, forwarding, printing, or copying is strictly >> prohibited. Please notify Archemix Corp. immediately at either (617) >> 621-7700 or by return fax at (617) 621-9300 and destroy all copies of this >> message and any attachments. >> >> >> > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317963 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Calling functions with cfoutput
Is it getting rendered out side the cfform? On Wed, Jan 14, 2009 at 12:16 PM, Damayanti Gupta wrote: > I have a cfform. From this I call a function, which has cfoutput tags to > output text. However this text is not getting printed to the form. Is this > expected? Is there a way around this? > Thanks > NG > > e.g. > > > This is a form > > > > > This is data to be printed > > > STATEMENT OF CONFIDENTIALITY: > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain confidential or privileged information. If you are not the intended > recipient, or the person responsible for delivering the e-mail to the > intended recipient, be advised you have received this message in error and > that any use, dissemination, forwarding, printing, or copying is strictly > prohibited. Please notify Archemix Corp. immediately at either (617) > 621-7700 or by return fax at (617) 621-9300 and destroy all copies of this > message and any attachments. > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317946 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Calling functions with cfoutput
You're not outputting it. You're setting it. this is a form. #doPrint()# On Wed, Jan 14, 2009 at 9:16 AM, Damayanti Gupta wrote: > I have a cfform. From this I call a function, which has cfoutput tags to > output text. However this text is not getting printed to the form. Is this > expected? Is there a way around this? > Thanks > NG > > e.g. > > > This is a form > > > > > This is data to be printed > > > STATEMENT OF CONFIDENTIALITY: > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain confidential or privileged information. If you are not the intended > recipient, or the person responsible for delivering the e-mail to the > intended recipient, be advised you have received this message in error and > that any use, dissemination, forwarding, printing, or copying is strictly > prohibited. Please notify Archemix Corp. immediately at either (617) > 621-7700 or by return fax at (617) 621-9300 and destroy all copies of this > message and any attachments. > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317943 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Calling functions with cfoutput
Try other way around: cfoutput in form: This is a form #doPrint()# This is data to be printed ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317942 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Calling functions with cfoutput
I have a cfform. From this I call a function, which has cfoutput tags to output text. However this text is not getting printed to the form. Is this expected? Is there a way around this? Thanks NG e.g. This is a form This is data to be printed STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, or the person responsible for delivering the e-mail to the intended recipient, be advised you have received this message in error and that any use, dissemination, forwarding, printing, or copying is strictly prohibited. Please notify Archemix Corp. immediately at either (617) 621-7700 or by return fax at (617) 621-9300 and destroy all copies of this message and any attachments. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317941 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4