Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

config_checkbox_select()

Description

Generate an html checkbox options block

used to generate the values of the checkbox, and the values are the checkbox labels the user sees. (But see
$usekeys, below.)
If set to false the values from $choices will be used for both the values of the options
and the text the user sees. Defaulted to true.

Parameters

ColumnTypeDefaultDescription
$name string the name of the checkbox block.
$label string the user text displayed to label the checkbox block. Usually a $lang string.
$current
$choices
$usekeys boolean true tells whether to use the keys from $choices as the values of the options.
$width integer 300 the width of the input field in pixels. Default: 300.
$columns integer 1 the number of columns to use
$autosave false
$on_change_js null
$hidden false
array string $choices the array of choices -- the list of checkboxes. The keys are

Location

include/config_functions.php lines 1063 to 1122

Definition

 
function config_checkbox_select($name$label$current$choices$usekeys true$width 300$columns 1$autosave false$on_change_js null$hidden false)
{
    global 
$lang;
    if (
trim($current) != "") {
        
$currentvalues explode(","$current);
    } else {
        
$currentvalues = [];
    }
    
$wrap 0;
    
?>
    <div class="Question" id="question_ echo escape($name); ?> echo $hidden "style=\"display:none;\"" ''?>>
        <label for="question echo escape($name); ?>" > echo escape($label)?></label>
         if ($autosave) { ?>
            <div class="AutoSaveStatus">
                <span id="AutoSaveStatus- echo escape($name); ?>" style="display:none;"></span>
            </div>
         ?>
     
        <table cellpadding=2 cellspacing=0>
            <tr>
                
                
foreach ($choices as $key => $choice) {
                    
$value $usekeys $key $choice;
                    
$wrap++;

                    if (
$wrap $columns) {
                        
$wrap 1;
                        
?>
                        </tr>
                        <tr>
                        
                    
}
                    
?>
                    <td width="1">
                        <input
                            type="checkbox"
                            name=" echo escape($name); ?>"
                            value=" echo escape($value); ?>"
                            id=" echo escape($name '_' $value); ?>"
                             if ($autosave) { ?>
                                onChange=" echo $on_change_js?>AutoSaveConfigOption(' echo escape($name); ?>');"
                             }
                            if (
in_array($value$currentvalues)) { ?>
                                checked
                             ?>
                        >
                    </td>
                    <td>
                        <label for=" echo escape($name '_' $value); ?>"> echo escape(i18n_get_translated($choice)); ?>&nbsp;</label>
                    </td>
                    
                
}
                
?>
            </tr>
        </table>
        <div class="clearerleft"></div>
    </div>
  
    
}

This article was last updated 30th April 2025 21:35 Europe/London time based on the source file dated 25th April 2025 15:15 Europe/London time.