textbox or NumericTextBox

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 16 Oct 2014 Link to this post

    I am designing a new page and decided to 100% telerik, no asp controls.  I have a question on the radTextbox, it says its HTML5 compatabile for an input type but when I put an input type of numbers and go into IE11, it still allows text in the text box, I would think this would only allow numbers.  I see there is a radNumericTextbox that achieves my numbers on textbox, but why both if they support HTML5?

    <td style="width:25%;text-align:right">Est. Attendance:</td>
                   <td><telerik:RadTextBox ID="txtAttendance2" runat="server" Width="80px" MaxLength="4" InputType="Number"></telerik:RadTextBox>
                       <telerik:RadNumericTextBox ID="txtAttendance" runat="server" Width="80px" MaxLength="4"></telerik:RadNumericTextBox>
                   </td>
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 21 Oct 2014 Link to this post

    Hi Kevin,

    Setting the InputType of the RadTextBox to Number will make the control render an HTML input element of type number. This input element allows non-numeric characters to be entered, however, the value is disregarded as invalid. You can see the same behavior if you place a simple input element with its type attribute set to number.

    <input type="number" />

    As you have noticed, the behavior seen when using RadNumericTextBox is different. This is because the control performs additional client-side validation of the characters that are entered in the input. If the user attempts to enter a character that is not allowed the control disregards it and alerts the user.

    Regards,
    Viktor Tachev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top