Symptoms
How to submit a form when the Enter key is pressed in a text field.
Diagnoses
Not possible out of the box. A feature request has been logged.
Resolution
As far as a workaround goes, I created the following solution:
- Create an invisible, literal Data Label on the Form or View.
- Create an expression on the Data Label with the following text:
<script> $('rname="textBox1"]').keypress(function(event) { if (event.keyCode == 13) { $('=name="btnSubmit"]').click(); } }); </script>
The script assumes a text box named "textBox1" and a button named "btnSubmit" (these can be changed in the script). It adds a keypress handler to the textbox, waiting for the enter key and then clicking the button.