[FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

  1. #1

    [FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

    On button AjaxEvent click, I want to set the value of a hiddenfield on the page. I simply did the following:

    Dim template As String = "Ext.getDom('{0}').value='{1}';"
    Me.btnTest.AddScript(String.Format(template, "HiddenFieldClientID", "SomeValue"))
    This threw a javascript error. The actual script set to the client has '<raw>' prepended plus the last 2 characters are swapped. Looks like TokenUtils.ParseTokens thinks my script is a function because it starts with 'Ext.get'. Not a big deal. I changed the script to something else that works. Just wanted to point this out in case someone is running into a similar issue.
  2. #2

    RE: [FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

    Hi Jacky,

    Thanks for pointing this out. I'm running a few tests to reproduce and will provide a fix.*


    Geoffrey McGill
    Founder
  3. #3

    RE: [FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

    Hi Jacky,

    Can you run the following sample and confirm if it's working for you or not.

    Example

    <%@ Page Language="C#" %>
    
    <%@ 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">
    
    <script runat="server">
        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            string tpl = "Ext.getDom('{0}').value='{1}';";
            this.Button1.AddScript(tpl, this.HiddenField1.ClientID, "SomeValue");
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Coolite Toolkit Example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Button ID="Button1" runat="server" Text="Submit">
                <AjaxEvents>
                    <Click OnEvent="Button1_Click" />
                </AjaxEvents>
            </ext:Button>
            
            <asp:HiddenField ID="HiddenField1" runat="server" />
        </form>
    </body>
    </html>
    For me everything appears everything is working correctly, although maybe I'm missing something from your scenario.

    Geoffrey McGill
    Founder
  4. #4

    RE: [FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

    Yup, I trimmed down the scenario too much. In my scenario, the AjaxEvent handler does more things that trigger more script to be sent to the client. The error occurs if Ext.getDom is not the only script that is being sent. I modified the AjaxEvent handler in your sample to also set the button's text.

        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            this.Button1.SetText("New Text")
            string tpl = "Ext.getDom('{0}').value='{1}';";
            this.Button1.AddScript(tpl, this.HiddenField1.ClientID, "SomeValue");
        }
  5. #5

    RE: [FIXED] [V0.7] Bug with adding script 'Ext.getDom(...' during ajaxevent

    Hi Jacky,

    The bug has been fixed and committed to SVN.*


    Thanks for reporting the defect.*


    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 1
    Last Post: Nov 18, 2011, 5:29 PM
  2. [CLOSED] AjaxEvent "after" script / listener
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 10, 2010, 3:31 PM
  3. [CLOSED] Adding a Script
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 09, 2009, 6:36 AM
  4. [CLOSED] Calling Java script function with in a AjaxEvent
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jul 21, 2009, 9:13 AM
  5. Adding java Extjs script Data grid
    By Shimon_wi in forum 1.x Help
    Replies: 2
    Last Post: Jun 16, 2008, 1:31 AM

Posting Permissions