Dynamic configuration of my block

Dynamic configuration of my block

by GUILLERMO TORBETT -
Number of replies: 1

Hello, I am trying to create a dynamic configuration of my block:

example:

$value = array(45, 18, 98);
            for ($i = 0; $i < count($value); $i++) {
                $valor = 'config_text' . $value[$i];
                $title = "Title text " . $value[$i];
                $mform->addElement('text', $valor, $title);
                $mform->setDefault($valor, 'default value');
                $mform->setType($valor, PARAM_RAW);
            }
But this doesn't work, form fields are displayed but values are not saved, any ideas, thanks.

Average of ratings: -
In reply to GUILLERMO TORBETT

Re: Dynamic configuration of my block

by GUILLERMO TORBETT -
I'm going to answer myself, maybe this can help someone too.
But it is necessary that the fields must be generated again to be saved.
Solution: condition the id of the course both get and post.
greetings to all