set TextInput placeholder attribute live from other field

Having this
$form
->schema([
TextInput::make('title')
->required(),
...
TextInput::make('seo_page_title')
->placeholder('This should reflect the "title" field to indicate default will be "title" if this field is empty.')
$form
->schema([
TextInput::make('title')
->required(),
...
TextInput::make('seo_page_title')
->placeholder('This should reflect the "title" field to indicate default will be "title" if this field is empty.')
How can I update the placeholder attribute live?
2 Replies
bernhard
bernhard2w ago
TextInput::make('title')
->live()
->required(),

TextInput::make('seo_page_title')
->placeholder(fn($get) => "The title is " . $get("title"))
TextInput::make('title')
->live()
->required(),

TextInput::make('seo_page_title')
->placeholder(fn($get) => "The title is " . $get("title"))
You could/should customize it further. For example use:
->live(onBlur: true)
->live(onBlur: true)
Or depending on your usecase
->live(debounce: true)
->live(debounce: true)
mmoollllee
mmoolllleeOP2w ago
Thank you so much and sorry for asking altough I could have found this in the documentation!

Did you find this page helpful?