Render condition based on a snippet that checks if focus is on a specific field

edited November 2, 2017 in Questions
Hey gang,

I'm noticing a reluctance to post because I feel like it's a simple question and that asking this question will out me as a novice. So, that's where I'm coming from with this question.


So here's my question:

When you are focused on a large text area, I want a responsive grid to render. How can I get a snippet to evaluate to true when the focus is on that field?

Here's my snippet attempt:
var params = arguments[0], $ = skuid.$;
var sFocus;
if ($("#subjectiveField").is(":focus")){
    sFocus = true;
}
    console.log('check result ' + sFocus);
    return sFocus;
Notes:
  • snippet name is subjectiveSnippet
  • focus field has a CSS class of subjectiveField

Comments

  • edited October 27, 2016
    bump
  • edited November 2, 2017
    Can you go with a custom field renderer? 

    I noticed that the html for each field's UI element is available for modification.

    e.g . something like this (may have to mess around with the object hierarchy)
    var field = arguments[0];
    $ = skuid.$;


    $(field.element).on('focus',function(){console.log('You have focused on me');});
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!