What does the UnobtrusiveJavaScriptEnabled key do in .NET?
From here:
The purpose of that setting is explained by Brad Wilson in his post Unobtrusive Client Validation in ASP.NET MVC 3. Putting it short - with this setting turned off client side validation is being performed using Microsoft javascript libraries (the same way it was performed in ASP.NET MVC 1 and 2). Otherwise (with setting turned on) client side validation is performed using JQuery Validate.
So in other words, your application probably has code that depends on the Microsoft JavaScript libraries that perform validation.
Related videos on Youtube
cloudworks
I'm a web developer in Dublin, Ireland. Originally from rural Wisconsin, I've spent most of the last decade in Australia, New Zealand and Ireland. I strive to make software that matters. To that end, I have extensive development experience across several technologies building human-centred software for healthcare, biotech, higher ed and online learning. I lead a small remote-first software company which improves the delivery and tracing of lab tests, allowing in-home and on-site sampling for easier testing and better outcomes. If you're looking for help with your project, get in touch. I'm easy to reach on Twitter where I'm @JeffBallweg. I'd love to go for a coffee, especially if you're in Dublin. ☕️
Updated on September 15, 2022Comments
-
cloudworks over 1 year
I am quite familiar with unobtrusive Javascript as a pattern, but I am curious what it means to the .NET framework.
I am working on a project as a front-end developer that uses .NET on the back end. While working with a developer (who also manages the server), he mentioned that UnobtrusiveJavaScript must be set to false for our project. That is, the project's web.config should have the following:
<appSettings> ... <add key="UnobtrusiveJavaScriptEnabled" value="false" /> </appSettings>
My first reaction was that this was bad practice, but when I though about it further, I realized that I don't really understand why .NET would even have such a setting at the project level to begin with, or whether it even matters for our particular project.
-
JamieD77 over 8 yearsfrom my experience this setting has only prevented functionality and not enabled functionality. If you don't plan on using things like
@Ajax.BeginForm
or@Ajax.ActionLink
, which can be implemented using standard$.ajax
, then I wouldn't worry too much about it. -
JamieD77 over 8 yearsbeing that it's in the project config i'd say that it wouldn't cause issues for other projects. I'm also pretty sure that it defaults to false. you can also enable the feature on a controller by controller basis bradwilson.typepad.com/blog/2010/10/…
-
-
Ciaran Gallagher about 5 yearsHi! Is this app setting still required on MVC5 projects?
-
NightOwl888 about 5 yearsThe setting is only required if you have some legacy dependency on the old Microsoft JavaScript libraries. If the setting is not explicitly set, the default value is
true
, indicating to use the (modern) JQuery Validate libraries. For a new project, you would never need to touch this setting.