A
A
Artem2017-02-15 11:33:47
Yii
Artem, 2017-02-15 11:33:47

If the class property is an array, is it possible to access its element from ActiveForm?

There is this property:

'circles'              => [
            0 => [
                'title' => 'years in IT',
                'titleValue' => 10,
                'data-percents' => 50,
            ],
            1 => [
                'title' => 'developers',
                'titleValue' => 50,
                'data-percents' => 50,
            ],
            2 => [
                'title' => 'projects',
                'titleValue' =>  150,
                'data-percents' => 50,
            ],
            3 => [
                'title' => 'customers & partners',
                'titleValue' => 200,
                'data-percents' => 50,
            ],
        ]

I need to fill it out from a form.
But I don't see any other options than to make a class property for each field that is changed.
It would be cool to write something like:
<?= $form->field($model, "circles['titleValue']") ?>

But this, as expected, does not work. Tell me how to be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question