Pressing "Enter" in a field editor to invoke an event

edited December 2018 in Questions
I fear this might cause some eye rolling as it not doubt has been round the houses, but a search on the communities didn't really turf up anything specifically similar to this... Is it possible (in Skuid circa 11.2.x) to have an action sequence fired off the user striking the Enter key (just like a standard desire to "submit" something)...

For example, I have a field editor with a field in it (maybe consider this to be a UI only model with one UI only field in it).

When a user enters a value, they can hit "enter" and it makes the page do something.

It seems so simple, and yet I can't find any way to achieve this? You have to whack a button set next to the form editor and the user has to click the button (and away you go).

Which means it might look something like this in Skuid:

image

To present something like this on the page:

image
And the user can enter a number and hit the search button - voila!

But now, you find me one Internet user who wouldn't expect to be able to enter a number in that box and strike "Enter" to affect the page..!

hmmm. Am I off to Javascript land? Or is it another one of the amazing Skuid features hidden just out of my sight :D



Comments

  • edited December 2018
    You can use a field snippet to add a listener to your field.  This example listens for an enter event (event.which == 13) and then calls another snippet.  You can call the action framework from a snippet as well. 


    var field = arguments[0],
        value = arguments[1];
        cellElem = field.element;
    $ = skuid.$;

    skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
        field.element.keydown(function(e){
            if ( event.which == 13 ) {
                skuid.snippet.getSnippet('Search')(field);
            }
        });
  • edited December 2018
    Thank you John, this seems like a likely solution; I'll give it a whirl this PM.

     I wonder if Spark will have "submission" style action options in it?!
  • edited December 2018
    I'm afraid not, as far as I could see, however it sounds like a cool enhancement request, so I will inform our dev team about it!
  • edited December 2018
    This sounds like a cool enhancement request, so I will inform our dev team about it! Thanks :-)
Sign In or Register to comment.