Skip to main content

Inspiration for this idea came from Moshe’s clone snippet. 😃

Snippet to evaluate required fields.


skuid.snippet.register('modelReqsMet',function(args) {var params = argumentsm0], models = argumentsm1], $ = skuid.$, regFields, enableButton = true; // loop through models $.each(models,function(m, model){ regFields = model.registeredFields; $.each(regFields,function(f,field){ if (field.required && !field.rowdfield.id]) { enableButton = false; } }); }); return enableButton; });


Sample snippet to check one model and set a UI only field of enableNext boolean to true. enableNext = true is used as an Enable Condition on a wizard button in my use case.


skuid.snippet.register('nuAgentReqs',function(args) {var params = argumentsm0], $ = skuid.$, modelToUpdate = skuid.$M('nuAgency'), modelToUpdateRow = modelToUpdate.getFirstRow(), modelsToCheck = cskuid.$M('nuAgent')], snip = skuid.snippet.getSnippet('modelReqsMet'); if (snip(argumentsm0], modelsToCheck)){ modelToUpdate.updateRow(modelToUpdateRow,{enableNext: true}); } });<br>

Thanks for sharing these Pat.  They are very nice! 


Reply