Skip to content

Issue with money input #989

@flatcapco

Description

@flatcapco

maryUI version

2.4.6

daisyUI version

5.1.5

Livewire version

3.6.4

What browsers are affected?

Firefox, Chrome

What happened?

TLDR: Using the money attribute on input doesn't show the value passed to the input. Instead it shows 0.

When did this happen: Since upgrading to latest MaryUI.

If I pass a float or string to the money input it shows 0.
If I remove the money attribute then the real value shows ie 50 or 50.0

I should add that this form sits within an x-modal on the page. If I add console logging to your current code:

        const parts = String(input.value).split('.')
        input.value = parts.length === 1 ? `${parts.shift()}.00` : `${parts.shift()}.${parts.pop().padEnd(2, '0')}`

        this.input = input
        
 // HERE:
        console.log(this.input.value);
        this.events = new Set()

then it shows .00 and 0.00 in the log.

However no functionality has changed since I updated - it's always been within a modal that loads when opened.

I'm still using this script:

        <script
            type="text/javascript"
            src="https://cdn.jsdelivr.net/gh/robsontenorio/[email protected]/libs/currency/currency.js"
        ></script>

And the same blade input code:

            <x-input
                :label="__('Amount')"
                prefix="EUR"
                wire:model="amount"
                money
            />

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions