Skip to main content

As my code gets more mature generic sequences are turning into functions of global objects… so I end up with snippets that look like this
Cal.popup_cancel();
Is is possible that you might add the option of running a function rather than a snippet on a button click ? It would save having to recreate these generic snippets for every form, for every popup.

Thanks for all your great work !

You could define these “utility functions” as Skuid Snippets, rather than global functions. Then you could run these “utility snippets” within various other snippets, for example say that you have Inline Javascript like this:



(function(skuid){<br>var $ = skuid.$;<br>var registerSnippet = skuid.snippet.registerSnippet;<br>var getSnippet = skuid.snippet.getSnippet;<br>//<br>// UTILITY SNIPPETS<br>//<br>registerSnippet('Cal.popup_cancel',function(){<br>&nbsp; &nbsp; // CODE GOES HERE<br>});<br>registerSnippet('Cal.popup_save',function(){<br>&nbsp; &nbsp; // CODE GOES HERE<br>});<br>//<br>// SPECIFIC SNIPPETS<br>//<br>registerSnippet('testPage.eventPopup.closePopupButton',function(args){<br>&nbsp; &nbsp; // Do some stuff<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; var result = true;<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; // Then run our utility snippet<br>&nbsp; &nbsp; if (result === true) {<br>&nbsp; &nbsp; &nbsp; &nbsp; getSnippet('Cal.popup_cancel')(args);<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; getSnippet('Cal.popup_save')(args);<br>&nbsp; &nbsp; }<br>});<br><br><br>})(skuid);