Currency field only shows custom symbol on forms page with dependsOn #4939
Answered
by
crynobone
rafaelsmith
asked this question in
Q&A
-
Description:Similar to this bug #2932 now it's appears with dependsOn
|
Beta Was this translation helpful? Give feedback.
Answered by
crynobone
Oct 18, 2022
Replies: 1 comment 3 replies
-
This seems to work fine for me. public function fields(NovaRequest $request)
{
$currency = $this->currency ?? config('nova.currency');
return [
ID::make()->sortable(),
Select::make('Currency')
->options([
'EUR' => 'EUR',
'MYR' => 'MYR',
'USD' => 'USD',
])
->default(fn () => $currency)
->displayUsingLabels(),
Currency::make('Amount')
->dependsOn('currency', function (Currency $field, NovaRequest $request, FormData $formData) {
if (! empty($formData->currency)) {
$field->currency($formData->currency);
}
})->currency($currency),
];
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
crynobone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to work fine for me.