4
Incorrect TextInput binding to number variable
planned
Fedir Ushakov
When
Input field
component's Value
property is being set to Number
property of app variable, it assigns 500
string value instead of number.Log In
Activity
Newest
Oldest
Kristian Gerkman
planned
Not sure if this issue was solved at some point in time, but this is relevant once again.
Greg Florkow
I believe this still not resolved, even setting input field type value as number will still result in a string. Not a major issue - can be overcome easily by running every user number input through NUMBER(), just might be a bit unexpected in some places.
H
Harri Sarsa
Merged in a post:
Inputs bound to number-type variables output string values
H
Harri Sarsa
If I have an Input component bound to a number-type page variable such as
pageVars.myNumber
, anything typed in by the user will result in a text string value saved to the variable.So if I type 1234, what gets saved is actually the string "1234". To treat it as a number in formulas, you should wrap it in the NUMBER function.
Treating this as a bug; Input field should infer its type from the bound variable's type, as well as allow the type to be set explicitly.
H
Harri Sarsa
Yup, need to fix this – you can get around it by manually listening to component onChange event and using e.g.
Set page variable
with NUMBER(outputs[:id].eventValue)
formula, so it casts it to number.