PDA

View Full Version : [CLOSED] Error: 'theForm' is undefined



marco.morreale
May 04, 2012, 1:36 PM
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('e xplorer') == -1);
var __theFormPostData = "";
var __theFormPostCollection = new Array();
var __callbackTextTypes = /^(text|password|hidden|search|tel|url|email|number |range|color|datetime|date|month|week|time|datetim e-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);
}
}
}

Daniil
May 08, 2012, 12:39 PM
Hi,

Apologize for the delay, somehow we missed the thread.

We are investigating a possible fix. Thanks for the report.

dataknox
May 09, 2012, 9:03 PM
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?

Daniil
May 09, 2012, 10:35 PM
We have not came up with a fix yet.

dataknox
May 10, 2012, 3:54 AM
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.

dataknox
May 10, 2012, 1:52 PM
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.

Vladimir
May 10, 2012, 7:18 PM
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)

Daniil
May 06, 2014, 6:40 AM
Here is a related thread:
http://forums.ext.net/showthread.php?33911