Skip to content

input type="number" does not allow floating point numbers #141

@trajano

Description

@trajano

the spec allows for floating point numbers if you have step specified e.g.

<input type="number" step="0.01" min="0.01" name="amount" />

But setValueAttribute of HtmlNumberInput requires a long v alue

    @Override
    public void setValueAttribute(final String newValue) {
        try {
            if (!newValue.isEmpty()) {
                Long.parseLong(newValue);
            }
            super.setValueAttribute(newValue);
        }
        catch (final NumberFormatException e) {
            // ignore
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions