RadTextBox SetFocusOnError Validate Issue

3 posts, 0 answers
  1. parlardin
    parlardin avatar
    5 posts
    Member since:
    Jul 2013

    Posted 07 Jul 2013 Link to this post

    i use RequiredFieldValidator to validate radtextbox,SetFocusOnError="true"
    telerik version:2012Q3

    first ,enter " ",validate event fire, display “notnull”
    sencond,enter “123” ,radtextbox not set value,validate event not fire

    asp.net textbox is ok

    <telerik:RadTextBox ID="txtAppId" runat="server" Width="300" AutoPostBack="false">
            <%--<asp:TextBox ID="txtAppId" runat="server" Width="300" AutoPostBack="false">
            <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="Dynamic"
                ControlToValidate="txtAppId" Text="NOT NULL" ErrorMessage="NOT NULL" SetFocusOnError="true">                          

  2. Vasil
    Vasil avatar
    1604 posts

    Posted 09 Jul 2013 Link to this post

    Hi parlardin,

    I have tested using the latest version Q2 2013 and it seems to work the same for RadTextBox and Asp:TextBox.

    Indeed the "   " is threaded as null, since the code of ASP Validator is like follows:
    function ValidatorTrim(s) {
        var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
        return (m == null) ? "" : m[1];
    function RequiredFieldValidatorEvaluateIsValid(val) {
        return (ValidatorTrim(ValidatorGetValue(val.controltovalidate)) != ValidatorTrim(val.initialvalue))
    This means that string that does not contain characters different than space will considered as null.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. parlardin
    parlardin avatar
    5 posts
    Member since:
    Jul 2013

    Posted 11 Jul 2013 Link to this post

    version Q2 2013 work fine ,thanks
Back to Top