[v2] Using reactive/dependent fields sends all fields to be saved
Having the following configuration
when I save the model, having selected
Expected:
Forms\Components\Section::make('Config')
->schema([
Forms\Components\Fieldset::make('config')
->relationship('config')
->schema([
Forms\Components\Select::make('driver')
->options(DriverOptions::options()->toArray())
->columnSpanFull()
->reactive(),
Forms\Components\Repeater::make('credentials')
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('value'),
])
->hidden(function (\Closure $get) {
return $get('driver') !== 'option1';
}),
Forms\Components\Repeater::make('credentials')
->schema([
Forms\Components\TextInput::make('extra_login'),
])
->hidden(function (\Closure $get) {
return $get('driver') !== 'option2';
}),
])
])Forms\Components\Section::make('Config')
->schema([
Forms\Components\Fieldset::make('config')
->relationship('config')
->schema([
Forms\Components\Select::make('driver')
->options(DriverOptions::options()->toArray())
->columnSpanFull()
->reactive(),
Forms\Components\Repeater::make('credentials')
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('value'),
])
->hidden(function (\Closure $get) {
return $get('driver') !== 'option1';
}),
Forms\Components\Repeater::make('credentials')
->schema([
Forms\Components\TextInput::make('extra_login'),
])
->hidden(function (\Closure $get) {
return $get('driver') !== 'option2';
}),
])
])when I save the model, having selected
option1option1 for instance and filling up the values, I get the extra_login field in my JSON attribute in my modelExpected:
- name: Name 1
- value: Value 1
- name: Name 1
- value: Value 1
- extra_login: null