Limit a text field to numeric only

Limit a text field to numeric only

Comments

  • Hi,

    I have a drowdown list which contains the selection of Mobile Phone and NRIC. Then next to it is a text field named Mobile phone / NRIC #. If the selection in the dropdown is mobile phone, I want to limit the text field into numeric only then if the selection is NRIC #, No restrictions needed (Free input). Is this possible? if yes, How can I achieve this?

    Thanks and Regards,
    Ezra

  • Hi Ezra,

    You may be able to do this with a horizonal stack. If you use a rule flow to show a number box instead of a text box for your condition, this should likely fit your needs. An example of this can be found at https://documentation.decisions.com/docs/horizontal-and-vertical-stack-layouts?highlight=horizontal stack

  • Hi Andrew,

    What if I want to have a fixed format in the text field. Something like a plate number. For example XXX ### where x = letter and # = number.

    Regards,
    Ezra

  • Hello Ezra,

    You can use a masked text box, select the ValueType to Custom and define a regex to format as expected. Refer to [url=https://documentation.decisions.com/docs/using-the-masked-textbox-control]Masked Textbox Control[/url] for detials.

    Thanks

  • Hi Osman,

    Can I change the masked textbox control format using an active form flow?

    Regards,
    Ezra

  • Hey Ezra,

    Unfortunately not. As suggested earlier, youll need to use a horizontal stack with multiple masked text boxes.

    Thanks

  • Hi Andrew / Osman,

    Thanks for the help!

    Regards,
    Ezra

  • Unknown
    edited November 2023

    Hi Osman,

    Additionally, for the number box, is it possible to restrict the user to not input a string at all? User can still input but being erased when exiting the field.
    On field:

    Regards.
    Ezra

  • Hey Ezra, \r\n\r\nFirstly, if you want users to just enter numbers, you can use the NumberBox to do so rather than the masked text box. However, if you'd like to use the masked text box, you can get a regex for it from any open-source platform and utilize it. \r\nWhen we use a regex to validate data in the masked text box, we can't restrict users from entering the incorrect data but won't allow submission of the form with incorrect data in the masked text box field. For example, if you use [color=rgb(29, 28, 29)][font=Monaco, Menlo, Consolas, \"Courier New\

  • Hi Osman,
    For the mobile phone screenshot, I am using number box but still user can input string, however, it dont allow submission. Is this expected behavior? Can I restrict the users not able to enter string at all?

    Regards,
    Ezra

  • I can see the behavior and dont expect it to work in such way. Im going to submit a dev task for this. I dont see any other default way to add numbers in the number box.

  • Hi Osman,

    Understand. Thanks for the assistance!

    Regards,
    Ezra

  • Unknown
    edited November 2023

    Hi Osman,

    How does the custom for Masked Textbox Control work? I tried something like below but is not working. No sample was provided in the documents too.

    Result:

    Regards,
    Ezra

Sign In or Register to comment.