CheckboxHelper.fwaction (2013-01-14) (Downloaded 30 times)
Compatible: Pro 4, Pro 5, Pro 5.5, and Pro 6
Author: Walter Davis
Add a PHP-based automatic “checked” attribute to your checkbox form elements. Enter the name of the variable that is either true or has a true-ish value, and the Action does the rest.
The code that gets written looks like this:
<?php if(!!$variable_name) print 'checked="checked"'; ?>
There is an additional option to add a hidden form field before the checkbox with its value set to nothing. This allows the absence of a checkbox to be processed by your form handler, to “un-set” the value if it was previously set. The code that gets written with this option enabled looks like this:
<input type="hidden" name="foo" value="" /> <input type="checkbox" name="foo"<?php if(!!$foo) print 'checked="checked"'; ?> value="1" />