I have a user creation form where there is a dropdown to set if the new user will be superuser or not:
<div class="row"> <?php echo $form->labelEx($model,'superuser'); ?> <?php echo $form->dropDownList($model, 'superuser', User::itemAlias('AdminStatus')); ?> <?php echo $form->error($model,'superuser'); ?> </div>
This dropdown has only two values (‘Yes’ and 'No). My form is actually working fine, but now I need that if ‘No’ is selected in this dropdown, I need another dropdown added to the form with ‘City’ list (this list will need to be loaded from DB using ajax).
So, the ‘user’ table has a field called ‘city_id’. This field would be NULL if the new user is a superuser (‘superuser’ = ‘Yes’) and it will keep the ‘city_id’ if the user is not a superuser (‘superuser’ = ‘No’)
Can someone help me?