Answer the question
In order to leave comments, you need to log in
Why does the dropdown field attribute get selected all the time?
I just replace the values for the dropdownlist when the value of another field changes:
function replaceCarsDropDown()
{
$.ajax({
url : '$urlGetDrivers',
type : 'post',
data : {
id : $('#panel_car_value_select2').val(),
//order_id: $model->id
},
success : function(data){
$('#panel-driver_id').empty();
$('#panel-driver_id').append($(data).children());
}
})
}
$result = $car->getDrivers();
$arr = [];
if ($result)
{
foreach ($result as $key => $item)
{
$arr[$item['id']] = $item['name'].' '.$item['surname'];
}
}
$return = Html::dropDownList('drop', null, $arr, [
'prompt' => '-- Выберите --'
]);
"
<select name=\"drop\">\n<option value=\"\">-- Выберите --</option>\n<option value=\"2\">asdf adf</option>\n</select>"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question