PDA

View Full Version : [CLOSED] Interesting note



cwolcott
Mar 07, 2013, 1:03 PM
I defined one of my controls in the following manner.



<ext:Hidden ID="hReqDetailRequestorId runat="server" ClientIDMode="Static" />


I later referenced it in a DirectEvent extra parameter like:


<ext:Paramater Name="Id" Value="hReqDetailRequestorId.value" Mode="Raw" />


Everything has been working just fine when running under Chrome/Firefox, but when I began to regression test in IE7/IE8 the code gave and error 'hReqDetailRequestorId' is undefined. I code not see the issue until 5 minutes ago.

The code should have been


<ext:Paramater Name="Id" Value="#{hReqDetailRequestorId}.value" Mode="Raw" />

or


<ext:Paramater Name="Id" Value="App.hReqDetailRequestorId.value" Mode="Raw" />

I have the following code embedded in a much larger section of code that must be impacting it.

Any reason why the original code worked fine in Chrome/Firefox? I just thought it was interesting, please close the thread.

Daniil
Mar 07, 2013, 2:24 PM
Hi Chris,

Yes, this is interesting.

I discovered this issue quite long ago, but not 100% sure about the reason.

Probably, a browser shares DOM objects' ids into a global JavaScript object.

Look at this example. I would bet it showed undefined, but not.

Example

<%@ Page Language="C#" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Example</title>
</head>
<body>
<div id="div1"></div>
<input type="button" value="Click me" onclick="alert(div1);" />
</body>
</html>

cwolcott
Mar 07, 2013, 3:22 PM
You can close the thread. I just thought it was interesting and need to remember to write my code correctly (App. or #{}).