{"id":592,"date":"2012-10-25T01:46:50","date_gmt":"2012-10-24T20:46:50","guid":{"rendered":"http:\/\/www.esearing.com\/v2010\/?p=592"},"modified":"2012-10-25T01:46:50","modified_gmt":"2012-10-24T20:46:50","slug":"search-form-submission-without-submit-button","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2012\/10\/search-form-submission-without-submit-button\/","title":{"rendered":"Search Form Submission without submit button"},"content":{"rendered":"<p>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 a javascript function to submit the form values. This is useful for one or two form elements but not for forms with multiple elements.<br \/>\n<code><br \/>\n&lt;cfform name=\"formname\"&gt;<br \/>\n&lt;cfinput type=\"text\" name=\"search\" value=\"search\"  onkeypress=\"if(event.keyCode==13){javascript: YOURFUNCTION();}\"\/&gt;<br \/>\n&lt;\/cfform&gt;<br \/>\n<\/code><\/p>\n<p>You can then use javascript to get the values from the form and submit your code<\/p>\n<p><code><br \/>\nfunction YOURFUNCTION(){<br \/>\n  with(document.formname){<br \/>\n  action=\"hreflocaton\";<br \/>\n  method=\"post\";<br \/>\n  submit()<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2012\/10\/search-form-submission-without-submit-button\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,16,12,24],"tags":[],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-code","category-coldfusion","category-javascript","category-snippets-quick-code-tips-for-single-elements-attributes-or-details"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/592","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=592"}],"version-history":[{"count":3,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"predecessor-version":[{"id":595,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/592\/revisions\/595"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}