Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Exoseed's avatar

Dynamic link with Select input not working on Edit page

Hello,

I have a Select input on my form, which can dynamically change other inputs based on the item selected. The schema looks like this:

					->schema([
							Select::make('attribute_option_id')
								->relationship(name: 'attribute_option', titleAttribute: 'name')
								->searchable()
								->preload()
								->required()
								->live()
								->afterStateUpdated(fn (Select $component) => $component
									->getContainer()
									->getComponent('valueFields')
									->getChildComponentContainer()
									->fill()),
							Group::make()
								->schema(fn (Get $get): array => match ($get('attribute_option_id')) {
									'1' => [
										ColorPicker::make('value')
											->required(),
									],
									default => [
										TextInput::make('value')
											->required(),
									],
								})
								->key('valueFields')
								->columnSpan(1),
						])

My issue is that this works fine when I first use it when creating an item, but once it is created the correct value appears in the Select but the Group schema doesn't change accordingly (so where I would expect a ColorPicker there is a TextInput instead). Any idea why?

0 likes
0 replies

Please or to participate in this conversation.