Ignition 7.9.4
Attempting to use toInt to enable a button when an integer has been typed into a text box. If the user types 1234-a, this function returns 1234, not the fallback value.
Thanks!
Ignition 7.9.4
Attempting to use toInt to enable a button when an integer has been typed into a text box. If the user types 1234-a, this function returns 1234, not the fallback value.
Thanks!
Looks like our type-casting just strips alpha characters when attempting the conversion. I’ll let a dev answer whether that’s expected behavior or not - but in the meantime, you could use a Formatted Text Field to restrict which input characters are allowed.
Option 2: add a custom property (something like isInt, or whatever makes sense for you) to check if it really is an integer:
{Root Container.Text Field.text} = toStr(toInt({Root Container.Text Field.text}))
We’re using Java’s NumberFormat to do the parsing, and it strips out anything that doesn’t look like a number. So yeah, intended behavior.