HTMl Editor Clear Text.

  1. #1

    HTMl Editor Clear Text.

    Hi.

    Im cleaning the text of HtmlEditor with this code.

    function limpiar() {
            frm = document.getElementById('form1');
            
            var window = <%= Window1.ClientID %>;
            
            if (!frm) return;
            
            for(i=0; i<frm.elements.length; i++) {
                // alert(frm.elements[i].id + '   ' +  frm.elements[i].type);
                if (frm.elements[i].type == 'text')
                {
                    frm.elements[i].value = '';
                }
                else if (frm.elements[i].type == 'textarea')
                    var htmlEditor = &#100;ocument.getElementById(frm.elements[i].id);   htmlEditor.value = '';
            }
        }   
    }
    but not work...?

    Whats wrong..?

    Any Idea..?

    Thanks..
  2. #2

    RE: HTMl Editor Clear Text.

    Hi grmontero,

    I'm not really sure what should be happening. Can you provide more description and a full .aspx sample demonstrating the scenario?

    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: HTMl Editor Clear Text.


    O.k..
    here a example:

    I need to clear the TextFields... the textArea and the HtmlEditor.

    But the HtmlEditor dont change the text...

    The Button call 'Clear' Function.
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    <%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
    <!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 language="javascript" type="text/javascript">
        function clear() {
        frm = &#100;ocument.getElementById('form1');
        if (!frm) return;
        for(i=0; i<frm.elements.length; i++){
           if (frm.elements[i].type == 'text')
               {
            frm.elements[i].value = '';// Clear the Field
            }
            else if (frm.elements[i].type == 'textarea')
            {
                frm.elements[i].value = ''; // Clear the Field
            }
          }   
    }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        
        <ext:ScriptManager ID="ScriptManager1" runat="server" />
        <ext:Button ID="Button1" runat="server" Text="Submit" >
         <Listeners>
                                                <Click Handler="clear();" />
                                            </Listeners>
        </ext:Button> 
        <br />
        
        <ext:TextField ID="TextField1" runat="server" Text="safasdfd" Width="107px" />
        <br />
        <ext:TextField ID="TextField2" runat="server" Text="dsfdfads" />
        <br />
        <ext:TextArea ID="TextArea1" runat="server" Text="asdffsdgvs" />
        <br />
        <ext:HtmlEditor ID="HtmlEditor1" runat="server" Text="asdfdfasfdas" />
        </form>
    </body>
    </html>
    Any Idea Geofrey..
    Thanks.


  4. #4

    RE: HTMl Editor Clear Text.

    You can clear the value of a Field by calling .setValue("") on the Field component.

    Example


    HtmlEditor1.setValue("");

    Hope this helps.


    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. [CLOSED] Html editor text update
    By SymSure in forum 1.x Premium Help
    Replies: 1
    Last Post: Feb 08, 2012, 8:35 AM
  2. [CLOSED] Not able to Copy the Text from HTML Editor
    By speedstepmem3 in forum 1.x Premium Help
    Replies: 1
    Last Post: Nov 21, 2011, 8:10 AM
  3. Replies: 1
    Last Post: Sep 24, 2011, 10:52 PM
  4. Replies: 0
    Last Post: Sep 04, 2011, 8:29 AM
  5. html editor highlight and text color buttons
    By [WP]joju in forum 1.x Help
    Replies: 5
    Last Post: May 06, 2010, 8:38 AM

Posting Permissions