Skip to content

Instantly share code, notes, and snippets.

@dudelis
Last active January 9, 2018 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudelis/23f68b197a0d3e324f1680aa6a5658fa to your computer and use it in GitHub Desktop.
Save dudelis/23f68b197a0d3e324f1680aa6a5658fa to your computer and use it in GitHub Desktop.
K2 Smartforms: How to click a button upon enter key from textbox
<script>
$('.SFC.SourceCode-Forms-Controls-Web-TextBox').keypress(function (e) {
var key = e.which;
if(key == 13)
{
var value = e.currentTarget.value;
$(e.currentTarget).SFCTextBox('option', 'text', value);
$('a[name ="NameOfYOurButton"]').click();
return false;
}
});
</script>
@dudelis
Copy link
Author

dudelis commented Dec 13, 2017

  1. if you need a specific textbox, you need to change the first selector
  2. In the second part you need to enter the name of your button.
  3. If you have more than 1 button with the same name on the form, you need to change the selector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment