Retrieving Checkbox Values from Plugin I have a checkbox field that is populate with user choices.  I need to get the values they have selected from within a plugin. Here is my attempt. Not working.

    $entry  = craft()-&gt;entries-&gt;getEntryById($entryId, $localeId = null);
    foreach ($entry-&gt;storyCategories-&gt;options as $option) {
     var_dump($option);
    }


Can somebody please show me how to get these selected values?
You can pull an array of all the options for a checkbox field by calling getOptions():

$options = $entry-&gt;storyCategories-&gt;getOptions();


Each option will be an object with three properties, label, value and selected. To get all selected options for a field, you can loop through the options and test for the selected property:

$options = $entry-&gt;storyCategories-&gt;getOptions();
$selectedOptions = array();
foreach ( $options as $option ) {
    if ( $option-&gt;selected ) {
        $selectedOptions[] = $option;
    }
}


Note that this exact code will work for Dropdown, Multi-select and Radio button fields as well.