1
0
Fork 0
mirror of synced 2024-09-29 16:51:33 +13:00

Force number field to set numerical values only

This commit is contained in:
Andrew Kingston 2021-02-03 10:53:48 +00:00
parent 44cfd430c6
commit 181143935e

View file

@ -11,7 +11,12 @@
let fieldApi
const onBlur = event => {
fieldApi.setValue(event.target.value)
let value = event.target.value
if (type === "number") {
const float = parseFloat(value)
value = isNaN(float) ? null : float
}
fieldApi.setValue(value)
}
</script>