{"id":265,"date":"2010-07-06T12:19:24","date_gmt":"2010-07-06T16:19:24","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=265"},"modified":"2010-07-06T12:19:24","modified_gmt":"2010-07-06T16:19:24","slug":"cfselect-and-bind","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/07\/cfselect-and-bind\/","title":{"rendered":"cfselect and bind"},"content":{"rendered":"<p>I got to use more binding this week. Oh what a joy. Just don&#8217;t have any errors in your SQL, your CFC, or your cfselect<\/p>\n<p>formpage.cfm<br \/>\n<code>cfselect name=\"partnum\" bind=\"cfc:part_functions.getPartnum()\" value=\"partnum\" bindonload=\"yes\"<\/code><\/p>\n<p><strong>part_functions.cfc<\/strong> &#8211; Note brackets removed due to coding issues.<br \/>\n<code>cffunction name=\"getPartnum\" access=\"remote\" hint=\"get a list of the partnumbers\"<br \/>\n&nbsp;<br \/>\n\t\tcfset var qPartnum = ''<br \/>\n&nbsp;<br \/>\n\t\tcfquery datasource=\"#DSN#\" name=\"qPartnum\"<br \/>\n\t\t\tselect ' All' as Partnum<br \/>\n\t\t\tUNION ALL<br \/>\n\t\t\tselect distinct Partnum<br \/>\n\t\t\tfrom parts_table<br \/>\n                        order by Partnum<br \/>\n\t\t\/cfquery><br \/>\n&nbsp;<br \/>\n\t\t cfreturn qPartnum<br \/>\n\t \/cffunction><\/code>\t<\/p>\n<p>Notice the space in the SQL &#8221; All&#8221; as Partnum. That allows All to be the first option after the sort, I can then perform logic tests against it when passing the form values. You can also just use a blank value or zero.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I got to use more binding this week. Oh what a joy. Just don&#8217;t have any errors in your SQL, your CFC, or your cfselect formpage.cfm cfselect name=&#8221;partnum&#8221; bind=&#8221;cfc:part_functions.getPartnum()&#8221; value=&#8221;partnum&#8221; bindonload=&#8221;yes&#8221; part_functions.cfc &#8211; Note brackets removed due to coding issues. &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/07\/cfselect-and-bind\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}