Skip to main content
shobhits0002
Inspiring
Aug 23, 2022 2:39 PM UTC
Solved

formatting should be 7 digits + a space + 4 digits = 11 digits with a space in the middle. e.g. 1234567 1234

I have a requirement for formatting the field where it should be  of 7 digits + a space + 4 digits = 11 digits with a space in the middle. e.g. 1234567 1234.

Any help will be appreciated.

Thanks,

Shobhit

    Inspiring
    Aug 23, 2022 4:13 PM UTC

    Try this one.

    text(
    "12345678901",
    "####### ####"
    )

    3 replies

    stewart.burchell
    Employee
    Aug 23, 2022 3:04 PM UTC

    You can use the like() function. Something like this seems to meet your requirements:

    fn!like(
      ri!input,
      "[1-9][1-9][1-9][1-9][1-9][1-9][1-9] [1-9][1-9][1-9][1-9]"
    )

    (note that there is a space between the first group of seven [1-9] and the last group of four [1-9]. Also note that if you want to allow a zero in either of your groupings of digits you can adjust the relevant [1-9] to [0-9] as required)

    ...where ri!input is a text field.

    shobhits0002
    Inspiring
    Aug 23, 2022 3:53 PM UTC

    Hi Stewart,

    Thanks for your reply. But, this won't format the values entered in the field as required.

    Inspiring
    Aug 23, 2022 4:13 PM UTC

    Try this one.

    text(
    "12345678901",
    "####### ####"
    )