There may be an easier way, but I usually do it with a custom snippet higher up on the page. In this example, I store and retrieve the default fieldnames to check from the snippet properties so they'll be sticky and reset that value from the $_POST array when the form is submitted. I had to move some code around for this example to keep the size down, so the overall logic may not be correct, but it should give you the idea.
In the Tpl chunk:
<input type="checkbox" name="sitecheck_tests[]" [[!+checkCharsetChecked]] value="checkCharset"/> Check DB Character Set<br/>
In the snippet:
if ($formSubmitted) {
if (isset($_POST['sitecheck_tests']) && is_array($_POST['sitecheck_tests'])) {
/* this part updates the default properties */
foreach($_POST['sitecheck_tests'] as $test) {
$properties[$test] = true;
}
$defaults = implode(',', $_POST['sitecheck_tests']);
} else {
$defaults = '';
}
/* set defaults in snippet properties to make them sticky */
$snippet = $modx->getObject('modSnippet', array('name' => 'SiteCheck'));
if (!$snippet) {
die('Could not fine SiteCheck snippet');
}
$props = $snippet->getProperties();
$props['defaultTests'] = $defaults;
$snippet->setProperties($props);
$snippet->save();
} else {
/* This part sets the checkboxes */
$defaults = $modx->getOption('defaultTests', $scriptProperties, '');
$defaults = explode(',',$defaults);
$chunk = $modx->getChunk('SiteCheckTpl');
foreach($defaults as $default) {
$chunk = str_replace('[[!+' . trim($default) . 'Checked]]', 'checked="checked"', $chunk );
}
return $chunk;
}
If you show the form again after submission, the page needs to be uncached.