-
Description:Value of BelongsTo field resets to its initial value when dependsOn itself. /**
* App/Nova/Post.php
*/
public function fields(NovaRequest $request)
{
return [
// [...]
BelongsTo::make('User')
->dependsOn(
['user'],
function (BelongsTo $field, NovaRequest $request, FormData $formData) {
$field->help(
'$formData->user = '.var_export($formData->user, true).' '.
'$field->value = '.var_export($field->value, true)
);
}),
// [...]
];
}1. Initial state of form field 3. Form field state after new user selection Detailed steps to reproduce the issue on a fresh Nova installation:Check reproduction repository. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
|
Yes, this is the expected behavior to avoid the initial default being populated and only consider |
Beta Was this translation helpful? Give feedback.
-
|
@kusab85 have you found a way around? :) |
Beta Was this translation helpful? Give feedback.
-
|
You should be able to depends on self in 4.26.0 |
Beta Was this translation helpful? Give feedback.



Yes, this is the expected behavior to avoid the initial default being populated and only consider
$field->valueassigned viadependsOn()