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 a javascript function to submit the form values. This is useful for one or two form elements but not for forms with multiple elements.

<cfform name="formname">
<cfinput type="text" name="search" value="search" onkeypress="if(event.keyCode==13){javascript: YOURFUNCTION();}"/>

You can then use javascript to get the values from the form and submit your code

function YOURFUNCTION(){

Cup size   
Select size then click on coffee cup.
This entry was posted in Code, Coldfusion, Javascript, Snippets. Bookmark the permalink.