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

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.$;<br>var sFocus;<br>if ($("#subjectiveField").is(":focus")){<br>&nbsp; &nbsp; sFocus = true;<br>}<br>&nbsp; &nbsp; console.log('check result ' + sFocus);<br>&nbsp; &nbsp; return sFocus;



Notes:

  • snippet name is subjectiveSnippet
  • focus field has a CSS class of subjectiveField

bump

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];<br>$ = skuid.$;<br><br><br>$(field.element).on('focus',function(){console.log('You have focused on me');});