Skip to main content

Hello, I have a use case from a client where they would like to have a way to put their cursor in a skuid field that already has a value in it and when they click to put their cursor in it or open it up for editing that the field value would go blank. In their use case they have a lot of number fields where they are changing multiple values and having one be 0 for instance, they have to delete the zero to be able to change it to 1 instead of 10. We’ve explained they can tab through each field which would highlight the values, but they are looking to have a bit of a different experience if possible. If anybody has any ideas on how to solve this via a snippet that would be super helpful! Thanks!

This sounds like a perfect use case for javascript custom renderer.  This renderer could detect edit mode and in that case remove all the value of the field. 


The following inline-snippet should solve your use case.


(function(skuid){ var $ = skuid.$;<br>$(document.body).one('pageload',function(){<br> $('input').on('focus', function() {<br> &nbsp; &nbsp;$(this).val('');<br> });<br>});<br>})(skuid);

Thanks Thimo! 


Yes, thanks so much guys! I’ll check this out!


Thanks, Thimo this comes really close to solving my use case after finally getting back to this topic! I noticed that this only works if the field editor comes defaulted as “edit” and when the field is in read with in-line edit it doesn’t work even if you were to open it up for editing. My question might have been a bit unclear originally, but would you know of any way to allow it to function regardless of what mode the field editor comes pre-loaded as and if you were to click into a field? Also, when we excute any other javascript snippets on the page this functionality is lost. Have you found any ways to allow something like this inline resource to continue to work even after javascript snippets have been run? Thanks! Jeff