Selected issue with Cakephp 3.0 element form element

I am facing a problem in edit mode.

The radio button is not displayed as selected.

This is my code

    <div class="control-group required"><label class="control-label"><?php echo __('status') ?></label><div class="controls">
            <?php

            $attributes = array(
                'selected' => 1
            );
            echo $this->Form->radio(
                    'status', $statusData,$attributes
            );
            ?>
            <span id="error" class="error"></span>
        </div>

    </div>

      

+3


source to share


1 answer


try it:



$attributes = array(
   'value' => '1'
);

$statusData = array(
   '1' => 'Yes', '0' => 'No'
);

echo $this->Form->radio(
   'status', $statusData,$attributes
);

      

+1


source







All Articles