After selected item from the ajax select box. How can I set other from field value based on the selected item?
$form->select('product_id', "Product")->options(function ($id) {
$item = Product::find($id);
if ($item) {
// I want to set the price filed value using $item->price.
return [$item->id => $item->name];
}
})->ajax('/admin/api/products')->rules('required');