Skip to content

ui:emptyValue=null does not work with number inputs #1268

@glompix

Description

@glompix

Prerequisites

Description

Using ui:emptyValue=null with a type=["number", "null"] property doesn't actually give you null back. This appears to be an issue with when util.js:asNumber(null) ends up using new Number(null) which yields 0.

Steps to Reproduce

Make the age field empty. With the default widgets and current state, this is impossible, but it would be possible if asNumber is fixed. I have a custom Widget that passes null up thru onChange that reproduces this as well.

Playground Link

Expected behavior

For the value in formData to be null.

Actual behavior

The value in formData is 0.

Version

1.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions