Press "Enter" to skip to content

Click a button upon Enter in a textbox

0

When you fill in the form, you sometimes want it to be submitted upon hitting Enter. In other words, you need a functionality to click a button upon Enter in a textbox or any other control. Unfortunately, K2 misses Enter key press event. Here is a piece of code, which you can embed into a literal Data Label on your form.  Please, refer to the article How to add JavaScript on Smartforms. It can then fire a rule, which is bound, let’s say, to you Submit button.

Take the following into account, when using the functionality to click a button upon enter:

  • all textboxes on a form will acquire this functionality – if you need a specific textbox, you need to change the first selector;
  • instead of ‘NameOfYOurButton’ you need to enter the name of your button;
  • if you have more than 1 button with the same name on the form, you need to adjust the selector (e.g. searching for a specific view and then selecting the button with a specific name etc.).

Leave a Reply

Your email address will not be published. Required fields are marked *

17 + one =