views:

143

answers:

1

I've just run across an annoying "feature" of the Client-Side Validation that I'm wondering if someone with better js understanding than myself might be able to solve.

YSlow recommends that javascript be loaded at the end of the page. All good. Add the references to the required .js files at the bottom of the Site.Master and all is good, until you want to use ClientSideValidation...

This injects the EnableClientValidation call immediately after the form being rendered (it renders it as part of the Dispose method on the Form), however for some reason that escapes me this call never gets invoked (because the function definition is not yet loaded?).

Any ideas how I can still load the .js files at the end of the page and also use Client-side validation?

+1  A: 

I think that fundamentally your trying to call something that doesn't exist at that point.

There may be some technique that will allow you to do it but its going to complicate you life massively. In the spirit of "simplest thing that can possibly work", I'd suggest that you move your js to the top of the page or find a validation framework that allows you to move where you call it.

I'm well aware that I just stated the obvious but I find stuff like that helpful when I'm thinking in purely technical terms.

Simon Farrow