Problem with TextArea and TexField - accepting XML text

  1. #1

    Problem with TextArea and TexField - accepting XML text

    Hello All,

    I read i think all threads about this :) But still didnt understand how to resolve my problem without changing ValidateRequest for page.
    I just need to have TextArea where user can write XML / HTML code, and then send this text to the server, or init this area with
    code from server.
    I think that this is very simple situation, but i still didnt find a way how to do this.
  2. #2
  3. #3
    Hello Daniil,

    Thank you for you reply.
    Problem is that encode is ok when i want to set value of TextArea with XML from server,
    but when i want to submit data - i cannot do html encode on the fly, before request is sent to server,
    or at least i don't know how to do this from code behind.
    I did same with HTMLEncode/decode without problems for grid panels for example, adding params
    to rowclick direct evetns.
    But didnt did this with Textarea, simply because here button can be not on the same panel where
    is textarea, but in tab panel, where this panel is, or even in higher level.

    Regards,
    Nedelcho
  4. #4
    You can set up SubmitValue="false" for a TextArea and submit it manually, for example, as an extra parameter of a DirectEvent.
  5. #5
    Hello,

    Yes, i already read this im some thread. And ofcourse i tried it. But i dont know how to do this.
    I also tried with X.GetValue() , but without success.
    May be will be better if i make small example what i did, and why it not working :)
  6. #6
    Here you are.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Submit(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", e.ExtraParams["value"]).Show();
        }
    </script>
    
    <!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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TextArea ID="TextArea1" runat="server" SubmitValue="false">
                <Listeners>
                    <AfterRender Handler="this.setValue('<div>Some html</div>');" />
                </Listeners>
            </ext:TextArea>
            <ext:Button runat="server" Text="Submit">
                <DirectEvents>
                    <Click OnEvent="Submit">
                        <ExtraParams>
                            <ext:Parameter 
                                Name="value" 
                                Value="Ext.util.Format.htmlEncode(TextArea1.getValue())" 
                                Mode="Raw" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>
  7. #7
    Hello Daniil,

    Thank you! :)
    You can mark thread as closed.

Similar Threads

  1. TextArea.Text
    By paual in forum 1.x Help
    Replies: 0
    Last Post: May 18, 2012, 3:30 AM
  2. Replies: 2
    Last Post: Mar 19, 2012, 11:08 AM
  3. Text counter for a textarea
    By jmilton in forum 1.x Help
    Replies: 1
    Last Post: Oct 11, 2010, 5:06 PM
  4. Replies: 0
    Last Post: Feb 08, 2010, 1:12 PM
  5. TextArea and Checkbox Alternate Text
    By jmilton in forum 1.x Help
    Replies: 3
    Last Post: Feb 03, 2010, 8:58 PM

Tags for this Thread

Posting Permissions