In order to work around this limitation, SharePoint provides the “_spBodyOnLoadFunctionNames” array. When the body is loaded, the onload event handler executes each function whose name is contained in this array.
… it bloody-well is! This post was very nearly “Things that piss me off 5: Internet Explorer” (that one may yet come) but I thought a more descriptive title would help more people struggling with the same problem to find it.
Anyway, it would obviously be nice to allow the user to remove a row if they’ve added one or two too many. The obvious solution seems to be to add a “-” button beside each. Easy, right?
As each row (the label, field itself (including button) and “-” link) is inside a div, the above code should remove that div and therefore remove the row. And it does… in Firefox. Try it in Internet Explorer and you get a message telling you “Error: ‘this.parentNode.parentNode’ is null or not an object”.
Don’t you just hate when you can easily find something your code claims it can’t? Am I the only one who screams “It’s right f**king there!!” at my monitor? In this case, the problem seems to boil down to IE’s supid, proprietary, fucked up way of attaching Event listeners. When you use Mozillas the W3C standard addEventListener method to attach a listener to an event, “this” in the event handler refers to the object which the event is called on. Obvious, yes? However when you use IE’s attachEvent instead, IE doesn’t seem to act in the same way. Apparently, instead, IE sets “this” in an event handler to the window object instead of the calling/event object! Another good job from Micro$oft!
Apparently it’s can be overcome, but that involves a lot of code and I refuse in principle to do that much inelegant hacking for something so simple. It’s much easier (and principled) to do this:
I love PHP. It’s everywhere. All my sites are written in it. My CMS is written in it. My blog engines, WordPress and b2evolution, are written in it. It’s free. It runs on any platform. Hosts all support it. With PHP 5 they’ve even done a lot of work on PHP4’s main downfall – lack of OOP support.
One thing really pisses me off though – it’s totally inconsistent. Consider these two functions:
In in_array the first parameter is what you’re looking for and the second is what you’re looking in (more or less consistent with preg_match). In strstr (and its derivatives) this order is reversed. Who on Earth let that slip through? I’m yet to find a free text editor that will tell you which parameters a given function expects (Dreamweaver does a decent job but it’s bloody expensive for a text editor!) the way Visual Studio does for C#, which I use a lot in work. Given that situation, you’d expect consistency in this sort of thing. Apparently not so. Instead, every time I want to use one of these functions I have to do a quick Google to bring me to the PHP manual page to tell me which order the parameters come in.
Of course they can’t even fix that without breaking backwards compatibility either, so we’re probably stuck with it. Bloody marvellous!
I recently encountered a problem with Microsoft’s ACT (part of Visual Studio 2003) when testing a web service by emulating a browser-based client. For posterity’s sake, here’s an overview of the problem and, more importantly, the solution.
Using Application Center Test (ACT) to help automate performance testing designed to compare the performance of a web service running on ASP .NET 1.1 with ASP .NET 2.0.
Originally .NET 2.0 seemed to be performing many times better than .NET 1.1, but it was soon discovered that when running .NET 2.0, ATC was receiving a lot of 302 errors on 2.0 which it wasnâ€™t on 1.0. On further investigation the Web Service wasnâ€™t actually making all the correct database calls and on installing HTTP Monitor, it became apparent that the login wasnâ€™t working. When I recorded the test using Internet Explorer 7, the HTTP requests worked as expected, however when ATC repeated them it was not returning the ASP.NET_SessionID.