I Want to load Switch widget dynamicaly base on user input

i have following database and i want to render switch widget based on the no_std fied in db like if no_std=42 then i want to render 42 switch input to my form but i dont dont no how to do that plz help mi

thank you

Create field in model for that std’s:

public $stds;

Add this field to Model::rules():

// for example

['stds', 'safe'],

Make for() in view:

for($i = 0; $ < $model->no_std; $i++) {

   echo $form->activeField($model, 'stds[]')


thank you its worked like a charm thanks once again