473,659 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox and getElementById

Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.

Sep 25 '06 #1
9 3007


ja*******@gmail .com wrote:

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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.
What excactly happens, what error exactly do you get in the JavaScript
console for which line?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 25 '06 #2
RVB
It's odd, what -should- happen is that the javacsript fires off on the
defocus (don't know the exact name) event on the textbox to fire off
validation at which point, it notes that the test text I've put in is a
blank space (which works in my test harness on FF).
What happens is....NOTHING! I fire up the javascript console in FF,
clear any style complaints it has and try again. No events fired, no
error messages occur in the console. I am at a complete loss as to
what's going on.
I even rechecked agsint the test harness to see the auto generated js
that gets put in and teh js files that get pulled from webresource.axd
(the script handler in webcontrols) and, bar the IDs of the field,
there's no difference.

Martin Honnen wrote:
ja*******@gmail .com wrote:

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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.

What excactly happens, what error exactly do you get in the JavaScript
console for which line?

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 25 '06 #3
ASM
ja*******@gmail .com a écrit :
Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.
what could break a poor undescore ?
Has anyone come across this before?
never seen an array of functions calling elements ...
did elements exist before statement of the array ?
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.
if you can't change anything ... what is the question ?

I understand you can't do :

var Page_Validators = new Array(
"ctl0_ContentPl aceHolder1_UcCo ntrol1__ctl1",
"ctl0_ContentPl aceHolder1_UcCo ntrol1__ctl3"
);

and only after work with
document.getEle mentById(Page_V alidators[i]).innerHTML = ... ;

perhaps could you try

document.getEle mentById(Page_V alidators[i].id).innerHTML = ... ;

--
ASM
Sep 26 '06 #4
ASM
RVB a écrit :

are you : jason.hau ?
why do you change your identity from post to post ?
It's odd, what -should- happen is that the javacsript fires off on the
defocus (don't know the exact name) event on the textbox
which textbox this time ?
(what is a textbox?)

eval(Page_Valid ators[i].innerHTML = ...);

? ?

Sep 26 '06 #5
ASM scribed:
>ja*******@gmai l.com a écrit :
>Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentP laceHolder1_UcC ontrol1__ctl1") ,
document.getEl ementById("ctl0 _ContentPlaceHo lder1_UcControl 1__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.

what could break a poor undescore ?
>Has anyone come across this before?
I don't understand why, but I recently encountered similar behavior with FF.
I had to precede all references to document with window, i.e.,
window.document .
--
Ed Jay (remove 'M' to respond by email)
Sep 26 '06 #6
RVB
Yeah, I keep forgetting to change to a nickname on groups and only
remember after my first post >_< (it helps keep down on the spam).

The textbox itself is just an input tag with type text set against it.
ASM wrote:
RVB a écrit :

are you : jason.hau ?
why do you change your identity from post to post ?
It's odd, what -should- happen is that the javacsript fires off on the
defocus (don't know the exact name) event on the textbox

which textbox this time ?
(what is a textbox?)

eval(Page_Valid ators[i].innerHTML = ...);

? ?

.
Sep 26 '06 #7
RVB
Well, I've just downloaded firebug for firefox which gives me a nicer
js console and doing document.getEle mentById worked fine! Very odd.
Seems to indicate that the validation functions aren't firing. I'll see
where exactly it's meant to be going.

Ed Jay wrote:
ASM scribed:
ja*******@gmail .com a écrit :
Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.
what could break a poor undescore ?
Has anyone come across this before?
I don't understand why, but I recently encountered similar behavior with FF.
I had to precede all references to document with window, i.e.,
window.document .
--
Ed Jay (remove 'M' to respond by email)
Sep 26 '06 #8
RVB
Not sure what you mean by "what could break a poor undescore ?".
While I can't change the output javascript, I can add javascript of my
own however, I'm not sure what I could add to alter the array/fix this
problem.
(The reason I've posted here ,as well as the .NET newsgroups, is that
its not completely a .NET problem, it's the js that's being produced by
..NET that's causing the problem. )

ASM wrote:
ja*******@gmail .com a écrit :
Ok, interesting problem here, I have a webcontrol that holds a textbox
and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentPl aceHolder1_UcCo ntrol1__ctl1"),
document.getEle mentById("ctl0_ ContentPlaceHol der1_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.

what could break a poor undescore ?
Has anyone come across this before?

never seen an array of functions calling elements ...
did elements exist before statement of the array ?
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.

if you can't change anything ... what is the question ?

I understand you can't do :

var Page_Validators = new Array(
"ctl0_ContentPl aceHolder1_UcCo ntrol1__ctl1",
"ctl0_ContentPl aceHolder1_UcCo ntrol1__ctl3"
);

and only after work with
document.getEle mentById(Page_V alidators[i]).innerHTML = ... ;

perhaps could you try

document.getEle mentById(Page_V alidators[i].id).innerHTML = ... ;

--
ASM
Sep 26 '06 #9
RVB
Additionally, it shows that the contents of the array are correct in
that they pick up the spans that contain the error messages.
(ordinarily works by setting these to visible if there's a problem and
prevents postback/submit of the page)

RVB wrote:
Well, I've just downloaded firebug for firefox which gives me a nicer
js console and doing document.getEle mentById worked fine! Very odd.
Seems to indicate that the validation functions aren't firing. I'll see
where exactly it's meant to be going.

Ed Jay wrote:
ASM scribed:
>ja*******@gmai l.com a écrit :
>Ok, interesting problem here, I have a webcontrol that holds a textbox
>and a requiredfieldva lidator from System.Web.UI.W ebcontrols 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_ContentP laceHolder1_UcC ontrol1__ctl1") ,
>document.getEl ementById("ctl0 _ContentPlaceHo lder1_UcControl 1__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.
>
>what could break a poor undescore ?
>
>Has anyone come across this before?
>
I don't understand why, but I recently encountered similar behavior with FF.
I had to precede all references to document with window, i.e.,
window.document .
--
Ed Jay (remove 'M' to respond by email)
Sep 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2474
by: R. Rajesh Jeba Anbiah | last post by:
In IE, I could be able to directly refer the "id", but it isn't possible in Firefox. Somewhere I read the solution is to refer the id like document.getElementById("month") in Firefox. If I do so, the script works well in Firefox, but IE throws error. (I have added the code snippet below). So, my question is: is there anyway to make the script work in all browser *without* any browser fix ie, without adding any browser detection check?...
3
4833
by: Philip | last post by:
I have just tried my website with Firefox v1.0 and when I try to load a movie using: document.getElementByID('MovieID').LoadMovie(0, 'MovieURL'); the browser tells me that LoadMovie is not a recognized function. This works fine on IE6. I need to change the movie depending on the buttons that the user presses, all on the same page. Is the only way to do this by changing the innerHTML of the 'MovieID'
5
2213
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine in IE, though. I know, IE is a bit more permissive than IE, and sometimes lets errors work when they shouldn't. But from what I can see, I just don't see what's wrong.
3
5168
by: David Hayes | last post by:
I've made tooltips work in Firefox*, but tooltip doesn't appear at the specified location until the SECOND time that the user passes the mouse over the location with the mouseover event. What I want is for the user to be able to put the mouse over text that gives a year (e.g., "(1932)", "(1946)" and "(1923)") and see the tooltip to the right and slightly beneath the year. (For the record -- this needn't concern the debugging effort --...
4
5124
by: tcole6 | last post by:
My problem appears to be Firefox specific. I have a hyperlink that loads a new window. This window contains hyperlinks that call javascript functions in the parent window and then closes the child window. The function that is called contains an XMLHttpRequest. My problem is that everything happens as it should, the innerHTML is changed by the results of the XMLHttpRequest and the child window closes. The problem is this, in Firefox,...
2
4567
by: reynoldlariza | last post by:
Can somebody please help me, i tried playing around with IE6 and Firefox 2.0 browser for setting zIndexes and hide & show of divs. It seems to work to both. I tried repeatedly clicking on different divs on IE and no problem, but on firefox if I do the same, some divs just got hidden without notice. try clicking variably on different divs and it will happen... How do I make this stable? ----------------------------- <HTML> <HEAD>...
6
2121
by: MZ | last post by:
Hello! The following js code doesn`t work fine on Firefox and I don`t know why. I have table with 30 rows and on IE I click once on analyse button and it fills my cells automaticaly, but when I click the same analyse button on Firefox it fills me only one row and force me to click 30 times to fill the whole table. I replaced js break; into js continue; but it didn`t help me.
21
2701
rrocket
by: rrocket | last post by:
This works great in IE, but does not do anything in FireFox... Any ideas of what could be wrong with it? I checked all of the values (in IE through alert statements since nothing shows up in FireFox) and everything is valid. Thanks... function spanHide(spanNum){ for(startValue = 1;startValue <= 8;startValue++){ var currentSpan = eval("document.all.spanShip"+spanNum+"_"+startValue); var InsureInfo_SpanInsure =...
1
3531
by: SunshineInTheRain | last post by:
My project has 3 files, File1 has included master page. file1 consists of iframe1 that load file2. File2 consists of iframe2 that load file3. Javascript used on each file to resize the iframe height based on the each iframe's content height. It is work well on IE, but the error "has no properties" occured with firefox on code as below. Where both code is to get the id of iframe on file1....
3
2055
by: GarryJones | last post by:
The following works in MSIE but not firefox. I suspect it has something to do with the fact that the element I am trying to access is not the "tid" which is the name of the DIV that is passed to this javascript. The function is a "show/hide" for a form. I want to ensure that any possible previously entered value is cleared so the user starts with an empty field with focus. I have tried to ways, with naming and getElementById but in...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.