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

Textbox changes to original value onfocus

2 Answers 29 Views
Input
This is a migrated thread and some comments may be shown as answers.
Nik
Top achievements
Rank 1
Nik asked on 27 May 2010, 02:41 PM
I've run into an interesting issue and hoping someone can shed some light.

I have a radNumericTextBox that has its value being validated and changed if invalid via set_textboxvalue function. The set_textboxvalue is working fine, however I found that if you click back in the textbox the value will return to what it was originally. What's causing this?

Using version 2008.1.515.20

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="sandbox.aspx.vb" Inherits="test_sandbox" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
    <script> 
    function update() { 
    $find('radTbQty').set_textBoxValue('1000'); 
    } 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"
        <rad:RadScriptManager ID="RadScriptManager1" runat="server"
        </rad:RadScriptManager> 
        <rad:RadNumericTextBox ID="radTbQty" CssClass="txtbox" Width="30px" MinValue="1" 
            MaxValue="4000" MaxLength="4" NumberFormat-DecimalDigits="0" Value="1" runat="server"
        </rad:RadNumericTextBox> 
        <href="#" onclick="update()">Update</a> 
    </form> 
</body> 
</html> 
 

2 Answers, 1 is accepted

Sort by
0
Nik
Top achievements
Rank 1
answered on 27 May 2010, 03:52 PM
Update: I found that using set_value instead of set_textboxvalue fixes the problem. But why?
0
Dimo
Telerik team
answered on 27 May 2010, 04:21 PM
Hello Nik,

Simply put, RadInput textboxes consist of two textboxes - one holds the formatted visible value and one holds the actual nonformatted value. The control works correctly when both textboxes have consistent values. You should always use set_value() to set the control's value, as it updates both the visible and the hidden textbox.

Kind regards,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Input
Asked by
Nik
Top achievements
Rank 1
Answers by
Nik
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or