Snippet to Uncheck a checkbox?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I feel like this is a very simple question, but I have a checkbox at the end of a wizard I need to uncheck, but I would like the field to render unchecked without the user having to manually uncheck it.

Is there a basic rendering snippet I can use to uncheck the box?
Photo of Jake Stallman

Jake Stallman

  • 386 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
For starters you could set the default value of the field to false. But assuming you want to use JavaScript, I would use a page load snippet, that runs when the page loads. Create a new snippet of type "inline" and add the following:

(function(skuid){    var $ = skuid.$;
    $(function(){
// The name of the Model your checkbox is in 
        var model = skuid.model.getModel('YourModel');
var row = model.getFirstRow();
        model.updateRow(row,{
// replace YourFieldName with the API name of your checkbox
YourFieldName: false
});
    });
})(skuid); 
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
If you always want the checkbox to be unchecked by default, Moshe's suggestion should work.

But if you only want to uncheck it when you get to a particular step (and otherwise have it remain checked) then you might want to build in the logic to un-check the checkbox into your Wizard Button.

Wizard Button can run a sequence of Actions --- using Skuid's "Action Framework". Just change the Action Type of your button to be "Run Multiple Actions". Add 2 Actions:

1. Update a field on row(s)
2. Navigate to Step

Action 1 can be used to uncheck your checkbox, and Action 2 will actually move the user to the step where the checkbox appears.

Here are screenshots of an example "Next Step" button i created in a wizard, where the next step is "step2", but it can be whatever step you want to go to.





NOTE: if the "Navigate to Step" option does not show up for you, make sure you are on Skuid 5.13 or higher --- if you're not, head to skuidify.com/SkuidReleases and install the latest release.