© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
14 replies
Damien

How to derive a value from another TextInput field correctly.

Firstly, if there is a specific piece of documentation for doing this, please point me there as I struggled to find it but otherwise, here is what I am trying to do.

I have the following form (attached image) and in the highlight box you will see 2 prices,
gbp
gbp
and
eur
eur
- What I want to be able to do is use a multiplier that is stored in the database to set the value of
eur
eur
once i have entered a price for
gbp
gbp
- I still want to be able to change this manually so it does not have to be disabled or anything but it would be nice if it worked in reverse. I.e, changing euro, changes the price of
gbp
gbp


I have the following
TextInput
TextInput
components:

TextInput::make('price_gbp')
    ->label('Price (GBP)')
    ->prefix('£')
    ->minValue(0)
    ->maxValue(999999)
    ->required()
    ->numeric(),
TextInput::make('price_eur')
    ->label('Price (EUR)')
    ->prefix('€')
    ->minValue(0)
    ->maxValue(999999)
    ->required()
    ->numeric(),
TextInput::make('price_gbp')
    ->label('Price (GBP)')
    ->prefix('£')
    ->minValue(0)
    ->maxValue(999999)
    ->required()
    ->numeric(),
TextInput::make('price_eur')
    ->label('Price (EUR)')
    ->prefix('€')
    ->minValue(0)
    ->maxValue(999999)
    ->required()
    ->numeric(),


I have looked at both the
->default()
->default()
method and
->afterStateUpdated()
->afterStateUpdated()
method but failed to get either working in a way that I would like to (probably a me issue)

any advice or guidance appreciated as always!
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Value from another field
FilamentFFilament / ❓┊help
3y ago
How to set value to createOptionForm from another field?
FilamentFFilament / ❓┊help
2y ago
Insert value from one field to another
FilamentFFilament / ❓┊help
3y ago