Price (in pence) field - show result in pounds in suffix/or somewhere else that's sensible
Hi, I am attempting to let a user enter a price in pence, and then show them the converted amount in pounds in a clean and simple way. I hace tried the following but unfortunately the suffix doesn't get updated.
Any ideas on how I could achieve someting like this? Thanks!
4 Replies
We had this tutorial: https://laraveldaily.com/post/filament-input-prefix-suffix-dynamic-based-on-other-input - not specifically your case because it's for MULTIPLE fields, but maybe would work for you, too, please try
@Ralph Morris A working example combining ^ tutorial and your code:
You need to use Filament form
Get
instead of record, as your record might not yet exist on create.I use a plugin for this: https://filamentphp.com/plugins/pelmered-money-field
User enters an amount in £ (or your chosen currency) and then it converts to pennies on save.
Worked an absolute charm. Thank you all!