RadNumericTextBox clear() method doesn't work

2 posts, 0 answers
  1. Sabrina
    Sabrina avatar
    30 posts
    Member since:
    Feb 2008

    Posted 17 Apr 2009 Link to this post

    Hello,

    I try to clear the value of a RadNumericTextBox.

    I write :

    <telerik:RadNumericTextBox ID="RedemptionRightException" MinValue="0" MaxValue="100" 
        
    EnableEmbeddedSkins="false" runat="server" ForeColor="Red" MinValue="0">
        <ClientEvents OnError="ErrorPercent" /> 
    </telerik:RadNumericTextBox> 

    function ErrorPercent(sender, args)     
    {  
     alert('value is not correct');          
     sender.clear();  
     return false;  
    }   

    But the value after the clear is 100.

    Can you help me ?

    Thanks,

    Sabrina
  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 17 Apr 2009 Link to this post

    Hello Sabrina,

    Try the following approach:
    <script type="text/javascript" language="javascript"
        function valueChanging(sender, args) 
        { 
            if (!isNaN(args.get_newValue())) 
            { 
                args.set_cancel(true); 
                alert('value is not correct'); 
                args.set_newValue(); 
            } 
        }    
    </script> 

    <telerik:RadNumericTextBox ID="rntb1" runat="server" MinValue="100" MaxValue="200"
        <ClientEvents OnValueChanging="valueChanging" /> 
    </telerik:RadNumericTextBox> 

    Let us know whether this helps.

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top