RadNumericTextbox and Regex

2 posts, 0 answers
  1. Sheryl
    Sheryl avatar
    7 posts
    Member since:
    Feb 2008

    Posted 08 Feb 2010 Link to this post

    Good afternoon All,
    I'm implementing a RadNumericTextbox for a timesheet entry page where the users are required to enter their time in half hour increments. 
    I've tried attaching a RegularExpressionValidator to the control which has it's ValidationExpression set to "^\d+\.[05]$". 
    I would expect an error on anything not ending with a 0 or 5.  I can't get this to accept an entry ending in a 0 (like 1.0 or 3.0).  It accepts entries ending in .5, as expected.

    If I set the ValidationExpression to "^\d+\.[12]$", it catches anything that doesn't end with a 1 or 2 - as I would expect.

    Is there something about an entry ending in 0?

    Here's the aspx for the Textbox

     

     

    <telerik:RadNumericTextBox ID="numtxtMonday" runat="server"

     

     

    ButtonsPosition="Right"

     

     

    EnabledStyle-HorizontalAlign="right"

     

     

    IncrementSettings-Step="0.5"

     

     

    InvalidStyle-ForeColor="red"

     

     

    MaxValue="24" MinValue="0"

     

     

    NumberFormat-DecimalSeparator="."

     

     

    NumberFormat-DecimalDigits="1" NumberFormat-GroupSeparator=""

     

     

    NumberFormat-AllowRounding="true"

     

     

    ShowSpinButtons="true" Type="Number" ValidationGroup="saveTime"

     

     

    Width="75px" Value="0.0" >

     

     

    </telerik:RadNumericTextBox>

    thanks!

     

    Sheryl

     

     

     

     

  2. Dimo
    Admin
    Dimo avatar
    8482 posts

    Posted 11 Feb 2010 Link to this post

    Hello Sheryl,

    RadNumericTextBox stores and passes its value as a number. So if you enter "1.0", the control will report its value as 1 to the validator. That's why the validation fails for entries ending in ".0".

    Please modify your validation expression or use a custom validator.

    Best wishes,
    Dimo
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top