This one has tripped me up a few times recently, so I thought it best to share.
This one has tripped me up a few times recently, so I thought it best to share.
If you assume "XHTML compliance" then all attributes will be "quoted" so you”d have to use the second (correct) form. The only tags where this isn”t realistic to apply are: CFIF, CFSET and CFRETURN (I think… are there others?).
Sean, true, but CFML is not "XHTML compliant", and thus my comment about it being inconsistent. After all, <CFPARAM NAME="x" DEFAULT="1"> is the equivelant to <CFIF NOT IsDefined("x")><CFSET x=1></CFIF>. Also, attributes passed to custom tags, <CFMODULE>, and others, need not be quoted.
Something else to remember, everytime you run cfparam, if you use "#somefunc()#" it will execute EVERY time, even if the variable you are checking for already exists.
Ray, I don’t get it…
If it executes every time, then why use cfparam instead of cfset. Am I misunderstanding or ar you saying that CFPARAM will execute the function without regard to whether the variable is already set?
-Igor
Leave a Reply