Reset for multiline RadTextBox

9 posts, 0 answers
  1. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 25 Dec 2009 Link to this post

     

    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.

  2. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 28 Dec 2009 Link to this post

    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.
  3. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 30 Dec 2009 Link to this post

    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.

     

  4. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 30 Dec 2009 Link to this post

    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.
  5. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 30 Dec 2009 Link to this post

    You are right, Ajax request was a reason. Thanks.
  6. Yvonne Patakidou
    Yvonne Patakidou avatar
    9 posts
    Member since:
    Jun 2009

    Posted 10 Feb 2010 Link to this post

    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" />  
  7. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 10 Feb 2010 Link to this post

    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.
  8. Yvonne Patakidou
    Yvonne Patakidou avatar
    9 posts
    Member since:
    Jun 2009

    Posted 10 Feb 2010 Link to this post

    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.
  9. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 11 Feb 2010 Link to this post

    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.
Back to Top