Firefox and getElementById

Giganews Newsgroups
Subject: Firefox and getElementById
Posted by:  jason.h…@gmail.com
Date: 25 Sep 2006

Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldvalidator from System.Web.UI.Webcontrols in .NET 2.0
(this is javascript related, bear with me).
The validator is added to the page validator collection so at run time,
..NET auto generates an array e.g.:
var Page_Validators =  new
Array(document.getElementById("ctl0_ContentPlaceHolder1_UcControl1__ctl1"),
document.getElementById("ctl0_ContentPlaceHolder1_UcControl1__ctl3"));
which it then references as part of the client side validation.
For some reason however, this works perfectly in IE, works fine in my
test harness but doesn't work in the release project. The ONLY possible
reason that I can see is that the release project has underscores in
the ID and my test harness does not.
Has anyone come across this before?
Please note 2 things:
1) The id attribute is auto-generated by .NET and thus I have extremely
limited control over altering it.
2) The array Page_Validators is auto-generated as well and I have
absolutely NO entry point with which to alter it so I CANNOT change the
method of .getElementById, etc.

Replies