Recieving Error: 'theForm' is undefined



I have an ASP.NET application which is giving the following JavaScript
error:

'theForm' is undefined

However, when I did a View Source I noticed that ASP.NET added the following
code:

<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>

I was told in a previous posting that the reason for the error is that the
script containing the declaration and assigning of a value to it occur
before the

--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/


.



Relevant Pages

  • serverseitige "Events" und (unnötiges?) JavaScript
    ... Postbacks realisiert werden. ... serverseitig das Event auffange das folgende JavaScript: ... theForm = document.aspnetForm; ... Nehme ich das Event heraus, ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Re: How can I put this javascript in external .js file?
    ... When I view the source of my site I see some javascript generated in the ... theForm = document.aspnetForm; ... this javascript is generated in the html output from the ... What you have read about placing scripts into external .js ...
    (microsoft.public.dotnet.framework.aspnet)
  • How can I put this javascript in external .js file?
    ... When I view the source of my site I see some javascript generated in the ... theForm = document.aspnetForm; ... this javascript is generated in the html output from the webserver.So ... I suppose some technique must be implemented which stop the html output from ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: raise page.postback with javascript
    ... How can I raise the postback event of my page with Javascript? ... theform = document.Form;} else { ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Recieving Error: theForm is undefined
    ... 'theForm' is undefined ... script containing the declaration and assigning of a value to it occur ... Nathan Sokalski ...
    (microsoft.public.dotnet.framework.aspnet)