Skip to main content
johnpauld0002
October 21, 2021
Question

Amount Format in IntegerField

  • October 21, 2021
  • 13 replies
  • 0 views

Is there any solution in Integerfiel to generate an Amount Format? but in textField my logic is working but my validations is not working. My validation is only numbers can accept in textField.

13 replies

October 21, 2021

For simple number validation within text field you can use cleanwith() function. Generally regex is used for more complex validations that involve pattern matching like email formats, etc. 

a!textField(
  label: "Formatted Number",
  value: if(
    or(isnull(ri!formattedNumber), ri!formattedNumber <> cleanwith(ri!formattedNumber, "1234567890.,")),
    ri!formattedNumber,
    text(ri!formattedNumber, "##,###.##")
  ),
  saveInto: ri!formattedNumber,
  validations: {
    if(
      ri!formattedNumber <> cleanwith(ri!formattedNumber, "1234567890.,"),
      "Please input numbers only",
      {}
    )
  }
)

johnpauld0002
October 21, 2021

I also tried this but I have problem says "Interface Definition: Expression evaluation error at function 'cleanwith' [line 112]: A null parameter has been passed as parameter 1.

October 21, 2021

remove that false in if statement and add null and try it

johnpauld0002
October 21, 2021

hi avinash. i try that solution but i gave me an error.

...

October 21, 2021

why not try the logic mentioned by hrishikeshd963it works good