Category Archives: Snippets

quick code tips for single elements, attributes, or details

CFQueryParam with Lists

If you have a form that gathers an element where the user can enter several items separated by commas, coldfusion gives you a couple of ways to deal with the sql statement. In older versions you might loop through the … Continue reading

Posted in Code, Coldfusion, Snippets, SQL | Comments Off on CFQueryParam with Lists

Search Form Submission without submit button

Here is a quick view of how to submit a form when the enter key is used instead of the submit button. OnKeyPress checks to see if the key code is 13 which is the enter/return key. Then it calls … Continue reading

Posted in Code, Coldfusion, Javascript, Snippets | Comments Off on Search Form Submission without submit button

SQL Rows to Column

I had an interesting challenge this week where I needed to turn rows of email addresses into a crosstab or a single column so I could use it to send out emails. I had to do this at a grouped … Continue reading

Posted in Code, Snippets, SQL | Tagged , , | Comments Off on SQL Rows to Column

CFSelect bind for Search or Edit on same form

Creating a data based derived dropdown list bound to a record for Search or Edit form is sometimes needed. For search you may want to return All as your first item in the dropdown, but for edit mode you likely … Continue reading

Posted in Code, Coldfusion, Snippets, SQL | Tagged , | Comments Off on CFSelect bind for Search or Edit on same form

Date Subtraction or Difference

Sometimes you need to know the differences between two dates in days months years whatever. SQL SERVER select datediff(day,date1, date2) as days_diff, datediff(month,date1, date2) as months_diff… Can also do year, quarter, week, hour, minute, and second dateparts. Dates can be … Continue reading

Posted in Code, Coldfusion, Javascript, JQuery, Snippets, SQL | Tagged | Comments Off on Date Subtraction or Difference