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

  • 2
  • Question
  • Updated 6 days ago
  • Acknowledged
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:



To present something like this on the page:


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
Photo of srlawr

srlawr

  • 536 Points 500 badge 2x thumb
  • quizzical

Posted 2 weeks ago

  • 2
Photo of John Dahlberg

John Dahlberg, Champion

  • 2,564 Points 2k badge 2x thumb
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);
        }
    });
Photo of srlawr

srlawr

  • 536 Points 500 badge 2x thumb
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?!
Photo of Luzie Baumgart

Luzie Baumgart, Official Rep

  • 1,502 Points 1k badge 2x thumb
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!
Photo of Luzie Baumgart

Luzie Baumgart, Official Rep

  • 1,504 Points 1k badge 2x thumb
This sounds like a cool enhancement request, so I will inform our dev team about it! Thanks :-)