{"id":21,"date":"2010-04-19T11:52:37","date_gmt":"2010-04-19T11:52:37","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=15"},"modified":"2010-04-19T11:52:37","modified_gmt":"2010-04-19T11:52:37","slug":"cf-datefield-calendar","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/04\/cf-datefield-calendar\/","title":{"rendered":"CF datefield calendar"},"content":{"rendered":"<p>CF8 came bundled with a neat feature to create a calendar form element.  <cfinput type=\"datefield\"...\nwill give you a nice calendar the user can select a date from. If you make the field readonly you can force the user to use the calendar.\n\nI have only found one small problem with this tag. If you build your form and output on the same page and send your output to excel (and possibly other formats), the form tries to include itself into excel and causes a missing CFIDE\/css file error message. You can get around this error by using cfif logic to keep the form and output separate.\n\n<code>Snippet:  &lt;cfinput type=&#8221;datefield&#8221; name=&#8221;mydate&#8221; readonly \/><\/code><\/p>\n<p><code><br \/>\n&lt;cfif not isDefined('form.mydate')><br \/>\n&lt;cform action=\"thispage.cfm\" method=\"post\" preserveData=\"yes\"><br \/>\n     &lt;label for=\"mydate\">The Date<\/label><br \/>\n     <strong> &lt;cfinput type=\"datefield\" name=\"mydate\" readonly \/><\/strong><br \/>\n...\/\/other html form elements here<br \/>\n     &lt;cfinput type=\"submit\" value=\"go\"><br \/>\n&lt;\/cform><br \/>\n&lt;cfelse><br \/>\n   &lt;cfquery name=\"get_date\"><br \/>\n    \/\/query stuff here<br \/>\n   &lt;\/cfquery><br \/>\n\/\/excel would go here using cfheader and cfcontent tags<br \/>\n   &lt;cfoutput query=\"get_date\"><br \/>\n    #mydate#<br \/>\n    &lt;cfoutput><br \/>\n&lt;\/cfif><br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>CF8 came bundled with a neat feature to create a calendar form element. &lt;cfif not isDefined(&#8216;form.mydate&#8217;)> &lt;cform action=&#8221;thispage.cfm&#8221; method=&#8221;post&#8221; preserveData=&#8221;yes&#8221;> &lt;label for=&#8221;mydate&#8221;>The Date &lt;cfinput type=&#8221;datefield&#8221; name=&#8221;mydate&#8221; readonly \/> &#8230;\/\/other html form elements here &lt;cfinput type=&#8221;submit&#8221; value=&#8221;go&#8221;> &lt;\/cform> &lt;cfelse> &lt;cfquery name=&#8221;get_date&#8221;> &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/04\/cf-datefield-calendar\/\">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-21","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\/21","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=21"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}