Bonehead Custom Tag mistake

This one cost me an hour of my time this morning, and most of lunch. I can blame the earlier time on lack of coffee, but, wow, this was a dumb one. I’m working on the ColdFusion Admin interface for Seeker, which is almost done by the way. From the list of Lucene indexes you can click to perform searches. This is handy when you want to build an index and then quickly test the results. I built out the UI and it basically came down to:

form code

if search has a value: cf_search dump results end if </code>

Whenever I entered a search term, however, the page would reload back to the home page for the CF Administrator. I thought perhaps it was a simple error, but no amount of try/catch or cferror would fix the issue.

I took my search custom tag and removed all the code and just did “hi” and even that wouldn’t work. Yet the exact same code worked outside the CF Admin in a test file.

I then tried cfmodule instead of cf_search and it worked. It was at this point I took a closer look at my code…

<cfmodule template="/stuff/search.cfm" stuff>

and noticed my file name…. search.cfm.

My file was calling itself as a custom tag. -boggle- In my own defense, I’ve used cfmodule for so long I’ve gotten a bit rusty with cf_ syntax.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments