1

I am trying to make a combo box for an edit page.

echo $this->Form->select('status', 
                        ['empty' => 'Select Status'], 
                        ['class' => 'form-control', 'required']
                    );

Here I want to add 2 things :

$options = array('0' => 'Inactive',
                 '1' => 'Active',
                );

and selected value. suppose that is $status;

I tried with different options but sometime it do not add classes and sometime it shows options in tag

It will be great if somebody give clue.

Thanks

1 Answer 1

1
<?= $this->Form->input('status', [
        'type' => 'select', 
        'options' => ['0' => __('Inactive') , '1' => __('Active')], 
        'empty' => __('Select Status'),
        'class' => 'form-control',
        'required' => true, 'label' => __('Type')
    ]) 
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.