UserControl and Javascript - The Javascript method defined in the UserControl is "not found"?

  1. #1

    UserControl and Javascript - The Javascript method defined in the UserControl is "not found"?

    hey,
    I have a UserControl in which i define a simple Javascript function:

    <script language="javascript" type="text/javascript">
    
        function CheckForCallback(success, errorMsg, customerId) {
            if (typeof window.opener.CustomerReportCallback == 'function') {
                window.opener.CustomerReportCallback(success, errorMsg, customerId);
            } 
            else alert('No method implemented');
        }
    
    </script>
    This function, "CheckForCallback" is called from the same UserControl in a Click listener like this:

    <ext:FormPanel ID="FormPanel1" runat="server" Height="330"  Width="460" Title="Kundinformation" Header="true" Padding="5" MonitorResize="true">
        <BottomBar runat="server">
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                    <ext:Button ID="btnSaveCreateCustomer" Icon="Disk" Text="Spara" runat="server" >
                        <Listeners>
                            <Click Handler="CheckForCallBack(1 , '', 0);" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </BottomBar>
        ...
    When trying this in Chrome I get the following Javascript error:

    Uncaught ReferenceError: CheckForCallBack is not defined
    Customers.aspx:24 Uncaught ReferenceError: CheckForCallBack is not defined
    Ext.form.FormPanel.bbar.items.listeners.click.fnCu stomers.aspx:24
    h.Event.fireext.axd:7
    Ext.override.fireEventext.axd:55
    Before I post a complete code example, anyone understands this? Must the Javascript functions be declared somewhere special?

    -- update --

    I removed the "window.opener" and then it started working better.
    Last edited by wagger; Mar 29, 2011 at 4:57 PM.

Similar Threads

  1. [CLOSED] "True is not defined" javascript error
    By coleg123 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 11, 2011, 6:51 PM
  2. Replies: 19
    Last Post: May 18, 2011, 4:45 PM
  3. Replies: 9
    Last Post: Apr 25, 2011, 8:23 PM
  4. Replies: 11
    Last Post: Mar 30, 2011, 2:21 PM
  5. Replies: 0
    Last Post: Mar 29, 2011, 5:32 PM

Tags for this Thread

Posting Permissions