Skip to main content
Known Participant
Jul 4, 2023 3:47 AM UTC
Question

Character limit on text field for decimal number

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
    Jul 4, 2023 5:25 AM UTC

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

    Known Participant
    Jul 4, 2023 5:28 AM UTC

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

    stefanhelzle0001
    Brainy
    Jul 4, 2023 5:37 AM UTC

    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), "#.#####")
          ),
        )
      }
    )