[CLOSED] Error: 'theForm' is undefined

  1. #1

    [CLOSED] Error: 'theForm' is undefined

    I activated Ext.NET 2.0 Beta in an asp.net project with AjaxToolkit Extension.
    As I add the resource manager to the master page I cannot change page in my gridviews. I got the following error:

    Microsoft JScript runtime error: 'theForm' is undefined

    In Visual Studio debugger I can see that the error occurrs in WebResourceXXX.axd file, here: (see // <------------- )


    var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
    var __theFormPostData = "";
    var __theFormPostCollection = new Array();
    var __callbackTextTypes = /^(text|password|hidden|search|tel|url|email|number|range|color|datetime|date|month|week|time|datetime-local)$/i;
    function WebForm_InitCallback() {
        var count = theForm.elements.length;               // <------------- 
        var element;
        for (var i = 0; i < count; i++) {
            element = theForm.elements[i];
            var tagName = element.tagName.toLowerCase();
            if (tagName == "input") {
                var type = element.type;
                if ((__callbackTextTypes.test(type) || ((type == "checkbox" || type == "radio") && element.checked))
                    && (element.id != "__EVENTVALIDATION")) {
                    WebForm_InitCallbackAddField(element.name, element.value);
                }
            }
            else if (tagName == "select") {
                var selectCount = element.options.length;
                for (var j = 0; j < selectCount; j++) {
                    var selectChild = element.options[j];
                    if (selectChild.selected == true) {
                        WebForm_InitCallbackAddField(element.name, element.value);
                    }
                }
            }
            else if (tagName == "textarea") {
                WebForm_InitCallbackAddField(element.name, element.value);
            }
        }
    }
    Last edited by Daniil; May 11, 2012 at 4:33 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Apologize for the delay, somehow we missed the thread.

    We are investigating a possible fix. Thanks for the report.
    Last edited by Daniil; May 08, 2012 at 11:42 AM.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Apologize for the delay, somehow we missed the thread.

    We are investigating a possible fix. Thanks for the report.
    I'm running into this also. Any update?
  4. #4
    We have not came up with a fix yet.
  5. #5
    Any idea what's causing it? This is a show stopper for me. I'm trying to use DevExpress controls within the Desktop and I'm getting this javascript error when I try to perform a callback.
  6. #6
    I found a workaround. At the bottom of your aspx page (after the closing </form>), put the following:

        <script type="text/javascript">
    <!--
            var theForm = document.forms['form1'];
            if (!theForm) {
                theForm = document.form1;
            }
            function __doPostBack(eventTarget, eventArgument) {
                if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                    theForm.__EVENTTARGET.value = eventTarget;
                    theForm.__EVENTARGUMENT.value = eventArgument;
                    theForm.submit();
                }
            }
    // -->
        </script>
    Be sure to replace "form1" with the ID of your main form.
  7. #7
    Fixed in SVN

    Please note that, by default, ViewState is disabled in v2 (it is removed from rendering)
    If you need viewstate then please set DisableViewState="false" for ResourceManager (or in extnet section of web.config)
  8. #8
    Here is a related thread:
    http://forums.ext.net/showthread.php?33911

Similar Threads

  1. Replies: 2
    Last Post: May 08, 2012, 3:34 PM
  2. [CLOSED] Error: 'theForm' is undefined
    By marco.morreale in forum 2.x Help
    Replies: 0
    Last Post: May 04, 2012, 12:36 PM
  3. [CLOSED] Error: Ext is Undefined
    By majunior in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 08, 2011, 5:57 PM
  4. [CLOSED] Error 'Ext' is undefined
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 18
    Last Post: Sep 06, 2010, 8:43 AM
  5. [CLOSED] Ext undefined error
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 11, 2009, 2:50 AM

Posting Permissions