This is a migrated thread and some comments may be shown as answers.

RadNumericTextbox and Regex

1 Answer 110 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sheryl
Top achievements
Rank 1
Sheryl asked on 08 Feb 2010, 10:09 PM

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

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 11 Feb 2010, 09:16 AM
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.
Tags
Input
Asked by
Sheryl
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or