Difference between jQuery Validation and Microsoft jQuery Unobtrusive - asp.net-mvc

What's the difference between the nugget packages Jquery Validation and Microsoft Jquery Unobtrusive when using them for validation?

jQuery Validation is just a javascript plugin used by Microsoft through its custom javascript named Microsoft jQuery Unobstrusive plugin to make ASP.Net MVC validation on client side a quiet simple.
jQuery Validation by definition (source https://jqueryvalidation.org/) :
This jQuery plugin makes simple clientside form validation easy,
whilst still offering plenty of customization options. It makes a good
choice if you’re building something new from scratch, but also when
you’re trying to integrate something into an existing application with
lots of existing markup. The plugin comes bundled with a useful set of
validation methods, including URL and email validation, while
providing an API to write your own methods.
Microsoft jQuery Unobstrusive need and works upon jQuery Validation. When you're using ASP.Net Validation like decorating your model with some data annotations attributes (Required, EmailAddress, etc), ASP.Net MVC generates some data-* attribute on fields that are related to your model. Microsoft jQuery Unobstrusive use those data-* and make your developer life easy so you don't need to code all thoses things describe in the jQuery Validation vidéo. That is why the Unobstrusive word is on Microsoft jQuery Unobstrusive. Go to this link to learn more about Unobstrusive Javascript

Related

Migrate from Legacy jQuery plugin to Bootstrap+Typeahead or jQuery UI Autocomplete

background:
We have a legacy system running the now dead Autocomplete plugin for jquery. We use it in multiple places on an intranet web UI. Until recently the client ran IE6 (yes, I know...) and this was all fairly static.
We're going to rededevelop the old front end of the UI. At the moment I'm considering using either jQuery UI or Bootstrap + Typeahead.
question:
The fields we use the autocomplete functionality often chain the values of other fields (themselves using autocompleted), passing these values as additional paramaters to our back end script. Is there an easy way to include these with the twitter bootstrap/typeahead method as there is with jQuery-UI?
If it's not too rude an example of each using additional parameters would be amazing.
Thanks in advance
edit:
I'm asking because I think bootstrap is smaller/lighter and less work to generate a nice UI.
We are using the Kendo UI Web (Free Version) autocomplete along with Bootstrap 3 and it is working very well.
The look is not like the other form elements generated by Bootstrap due to KendoUI CSS, but that seems minor.
We are also using MVVM pattern and Kendo Observables (Similary to Knockout) which makes it very easy to pass parameters to the backend systems.

Can JQuery do all this functionality?

As I am newbie to JQuery. I have certain questions in mind regarding JQuery.
Can I make complete website with Jquery?
Means in ASP.Net website we use Server Controls to design page, Can we make all this functionality on .ASPX page using JQuery?
If yes, then how to handle server side events?
For designing .ASPX pages, what we prefer to use? JQuery standard controls or Plugin?
No. JQuery is not a server-side framework. It's a client side DOM Manipulation domain specific language and API that enables client-side code to work cross-browser, and includes a variety of utility and helper functions for AJAX, deferred callback resolution, and generic functional programming.
In short, it is not meant to replace your server-side code.
The jQuery framework is only a javascript library which means it can only handle events or actions on the client-side. It doesn't matter what backend you are using for your website (PHP, ASP.Net, Python), javascript only works once the page has been rendered and sent to the browser. Try reading up on the docs for jQuery here: http://docs.jquery.com/
If you have any questions specifically about jQuery programming, we would be more than happy to answer them.

difference between jquery validate plugin and ASP.NET MVC data annotations?

I am wondering what is the difference between validating Controls using JQuery Validate plugin and ASP.NET MVC DataAnnotations?
Appreciate your responses.
Thanks!
JQuery Validate is a JQuery plugin for client side validations.
Up until MVC2 all the unobstruive ajax and validation targated ASP.NET AJAX library. but in asp.net MVC3 unobstruive ajax and validation targets JQuery and JQuery validate plugin.
see this video http://channel9.msdn.com/Series/mvcConf/mvcConf-2011-Brad-Wilson-Advanced-MVC-3 by Brad Wilson where he talks about custom unbostruive validations.
ASP.NET MVC DataAnnotations is a best way to validate your controls as they can validate your inputs to client side and server side as well.
In MVC 3 you can also use RemoteAttribute to send a remote call to an action method.

ASP.NET MVC 3 Unobtrusive client side Validation

Is there a reference available of the html validation attributes for cases where we want to use unobtrusive client side validation without using Data Annotations?
Thanks,
Ben
I don't think you will find a reference for this but if you are not going to use Data Annotations I would simply recommend you hooking up the jquery validate plugin manually.
We unfortunately had to do this recently, since only the view was under our control. Since the unobtrusive validation is really meant to be used in conjunction with data annotations, you probably won't find documentation online for how to use them separately.
We found that the easiest thing to do was to create a spike project, and add the correct data annotations to some test model, create a simple "EditorFor" view for it, look at the generated HTML, and copy over the data attributes that ASP.NET MVC added to the text boxes.

ASP.NET MVC & Ajax Control Toolkit

One of the things I like about coding "old skool" (web forms) is the AJAX Control Toolkit.
I saw on the Microsoft Storefront video 14, Rob Conery uses the TextboxWatermark control.
When I downloaded the code though, I couldn't find any reference to the Watermark control or any other control from the toolkit nor could I get it to work.
So my question is, does the AJAX Control Toolkit even work in an MVC / AJAX / JQuery type world without viewstate. What do you use for "simple" controls such as Calendar & Watermarks?
jQuery UI has a calendar and other UI components. Also check out the vast number of jQuery plugins.
I've been looking into this question recently and what I've found is that the AJAX Control Toolkit is not easy to use in the "JavaScript only" manner that you'd want to use for ASP.NET MVC. In fact it's a real pain. Here are two examples:
Example 1 - Popup Calendar
Example 2 - Auto Complete Text Field
Neither are easy.
You can give your MVC pages a code-behind and use the AJAX Control Toolkit as you would in regular ASP.NET, but that really violates the whole idea of MVC, so I wouldn't advise it.
My suggestion would be to follow Fredrik Kalseth's advice and use jQuery UI or one of the many plugins. Telerik also has some good looking Open Source MVC Controls that are based on jQuery.
Most of the AJAX Control Toolkit is available in MVC-friendly javascript form off the MS AJAX CDN. These can be used using a jquery plug-in syntax as well.

Resources