Skip to main content
July 4, 2023
Question

Character limit on text field for decimal number

  • July 4, 2023
  • 10 replies
  • 0 views

Hi All,

I have to apply character limit on text field like it will only show 5 digits after decimal and before decimal "n " number 

ex. if we enter 1234.123456789 , it will show and store only 1234.1234567

thanks in advance

    10 replies

    stefanhelzle0001
    Brainy
    July 4, 2023

    What is the reason to not use the floatingPointField? You could use the round() function to modify the value on save.

    July 4, 2023

    as per requirement we have to use it in text field only

    stefanhelzle0001
    Brainy
    July 4, 2023

    That's not a real reason, but here is a example that you should adapt to your exact needs.

    a!localVariables(
      local!value,
      {
        a!textField(
          label: "Decimal",
          value: local!value,
          saveInto: a!save(
            target: local!value,
            value: text(round(todecimal(save!value), 5), "#.#####")
          ),
        )
      }
    )