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
1 changed files with 6 additions and 1 deletions

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>