Control for entering phone number nt limited by length

Posted by: a.koneva on 10 May 2022, 1:09 pm EST

    • Post Options:
    • Link

    Posted 10 May 2022, 1:09 pm EST

    Hi

    I would like to create some textbox control in which user can enter only digits but not limited by length. How can I make it in C1? Should I use C1TextBox or something else?

    Best regards,

    Anna.

  • Posted 10 May 2022, 2:27 pm EST

    Hi Anna,

    You can use the C1TextBox for your requirement. To restrict the input to only digits, you can set the C1TextBox.CharCategory property to CharCategory.Number.

    Kind Regards,

    Kartik

  • Posted 10 May 2022, 9:35 pm EST

    Hi Kartik,

    Thank you for your answer, but it also enables entering space, but I would like to restrict it and enable only digits.

    Best regards,

    Anna.

  • Posted 10 May 2022, 10:29 pm EST

    Hi Anna,

    This behavior does not seem correct. We have reported it to the development team and will let you know as soon as we have an update. In the meantime, you can handle the KeyDown event of the C1TextBox to check if the Space key is pressed and set the SuppressKeyPress property of the KeyEventArgs to true. Kindly refer to the attached sample showing the same.

    Kind Regards,

    Kartik

    OnlyNumbers_C1TB.zip

    [C1WIN-27355]

  • Posted 13 May 2022, 2:01 pm EST

    Hi Kartik

    Thank you for your answer.

  • Posted 5 June 2022, 10:19 pm EST

    Hi Anna,

    As per the development team, this is the designed behavior of the C1TextBox as the CharCategory.Number option allows the space, backspace, and enter keys. If you want, we can post a feature request to the development team, to provide an option to exclude the space key from this behavior.

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels