pelmered / filament-money-field

Money field powered by Money PHP
MIT License
40 stars 19 forks source link

Input Mask not working #36

Open lpeterke opened 2 months ago

lpeterke commented 2 months ago

Hi there,

I am trying out this package and want to use the input mask. However, there seems to be a bug:

Alpine Expression Error: Invalid regular expression: /[^0-9]/g: Unterminated character class

Expression: "$money($input, '', ',', ' ', 2)"

I didn't do anything special, just added the MoneyInput to a resource create form.

pelmered commented 2 months ago

Thank you for the report. I would like some more instructions on how I can reproduce this.

Can you show me the exact code for the field and what changes you have made to the global configuration? Also maybe Filament version.

cgunnels commented 2 months ago

Hey @pelmered I'm running into the same issue. When I type or even on blur nothing happens. I believe this is because of these javascript/Alpine errors (screenshots attached). I can even type in letters and other characters. Here's my code:

Section::make('Pricing')->schema([
        MoneyInput::make('msrp')
            ->label('MSRP'),

        MoneyInput::make('retailPrice')
            ->label('Retail Price'),
  ])
  ->columns(4)
  ->collapsed(false),

Screenshot 2024-05-25 at 4 56 52 PM Screenshot 2024-05-25 at 4 57 19 PM

pelmered commented 2 months ago

@cgunnels Thank you for the report. I will revisit and rewrite the mask in the coming weeks. I have some ideas for that.

Until then I would suggest that you disable the mask if you are using this in production.

pelmered commented 1 month ago

I'm currently working on a fix for this. I hope that I can get it out this week.