I have an order form which has a product dropdown. I want to populate the price field based on the product selected. i have noticed there is a dependOn option for dropdown fields but was sure how to set a field value based on a dropdown.
code:
label: Code
required: 1
type: text
name:
label: Name
required: 1
type: text
dependsOn: code
And in the model, use the filterFields function
public function filterFields($fields, $context = null)
{
if (empty($this->code))
return;
// do something to get the name value based on the code
$newName = '';
$fields->name->value = $newName;
}