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

Reset for multiline RadTextBox

8 Answers 128 Views
Input
This is a migrated thread and some comments may be shown as answers.
spt
Top achievements
Rank 1
spt asked on 25 Dec 2009, 12:58 PM

 

Please take look at the following code:

 

<telerik:RadTextBox runat="server" ID="txtAddress" Text="Test Text" TextMode="MultiLine"  Rows="2"  Skin="WebBlue"/>  
<asp:Button runat="server" ID="btnReset" OnClientClick="document.forms[0].reset();return false;"  Text="Reset" UseSubmitBehavior="false" /> 
 

Let's enter some new text in the input text box and then click on the Reset button.

In FireFox 3.5.6.
    -Text box will be cleared
In IE 8 
    -Text box is not changed

In both cases original text will be displayed only when you give focus to text box.

8 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 28 Dec 2009, 01:53 PM
Hello Igor,

Please use the following approach, which will be incorporated in the next version of RadTextBox. Note that the custom Javascript code must be registered after the embedded one, i.e. you have to place it in the <body> or inside an external JS file, which is included in the <body>.

I have updated your Telerik points for this bug report. Thanks.


<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls for ASP.NET AJAX</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadTextBox runat="server" ID="txtAddress" Text="Test Text" TextMode="MultiLine" />
 
<asp:Button runat="server" ID="btnReset" OnClientClick="document.forms[0].reset();return false;"  Text="Reset" UseSubmitBehavior="false" />
 
<script type="text/javascript">
 
if (typeof(Telerik) != "undefined" && typeof(Telerik.Web.UI.RadInputControl) != "undefined")
{
    Telerik.Web.UI.RadInputControl.prototype._resetInputValue = function()
    {
        if (this._initialValue == null)
            this._initialValue = "";
 
        this._setHiddenValue(this._initialValue);
        var thisObj = this;
        window.setTimeout(function(){
            thisObj.updateDisplayValue();
            if ($telerik.isIE)
            {
                thisObj._textBoxElement.defaultValue = thisObj.get_displayValue();
            }
        }, 1);
    }
}
 
</script>
 
</form>
</body>
</html>


All the best,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
spt
Top achievements
Rank 1
answered on 30 Dec 2009, 07:32 AM

I tried to insert this script in my code,  but nothing happen.

 

I have added alerts in script and found that typeof

 

(Telerik.Web.UI.RadInputControl) is always  "undefined".
Please advice.

 

0
Dimo
Telerik team
answered on 30 Dec 2009, 07:51 AM
Hi Igor,

Did you try running my sample page? Does it work on your side (it should) ?

Probably you have included the script somewhere before the embedded script files. Another option is that your are making the RadTextBox visible after AJAX request. In this case you need to execute the custom script after you have shown the control (e.g. call it from another function).

All the best,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
spt
Top achievements
Rank 1
answered on 30 Dec 2009, 08:52 AM
You are right, Ajax request was a reason. Thanks.
0
Yvonne Patakidou
Top achievements
Rank 1
answered on 10 Feb 2010, 11:36 AM
Hello,

I have the same problem   with RadDatePicker conrtol. I use the code below.

 

 

 


I enter dates and click on "Search" button
I click on "Reset" button, Dates  will be cleared but on focus will be appeared again (IE 7)

Actual Result:
Previous dates are available again .

Expected Result:
On Reset fields should be empty

Thank you in advance

<telerik:RadDatePicker ID="txtDateFrom" runat="server">   
 
</telerik:RadDatePicker> 
 
 
 
<telerik:RadDatePicker ID="txtDateTo" runat="server">   
 
</telerik:RadDatePicker> 
 
 
 
<asp:Button OnClick="btnSearch_Click" ID="btnSearch" runat="server" Text="<%$ Resources:AdminResources, SEARCH %>" />&nbsp;&nbsp;&nbsp;<input id="Reset1" type="reset" value="Reset" />  
0
Dimo
Telerik team
answered on 10 Feb 2010, 02:16 PM
Hello Yvonne,

I can't reproduce the described behavior with RadDatePicker. Which RadControls version are you using?

Greetings,
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.
0
Yvonne Patakidou
Top achievements
Rank 1
answered on 10 Feb 2010, 05:00 PM
I use the latest version --> 2009.3.1314.35.
You submit the form with some selected dates and, after the postback, you click on reset button,the dates are disappeared but on focus are appeared again.
0
Dimo
Telerik team
answered on 11 Feb 2010, 08:24 AM
Hello Yvonne,

We tracked down the problem and fixed it. Changes will take effect in the next official release (Q1 2010 due in March), next beta (Q1 2010 Beta due next week) and next RadControls internal build (uploaded 1-2 times a week).

I have updated your Telerik points. Thank you.

All the best,
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
spt
Top achievements
Rank 1
Answers by
Dimo
Telerik team
spt
Top achievements
Rank 1
Yvonne Patakidou
Top achievements
Rank 1
Share this question
or