Search

Client side validation fails due to missing WebUIValidation.js reference by Willem-Derk Nijdam

Active

1
0
Sign in
to vote
Type: Bug
ID: 779281
Opened: 2/15/2013 1:07:06 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
.net 4.5 uses unobtrusivevalidation. By default the javascript for client side validation is not loaded and client side validation does NOT occur.

An explicit reference to <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" /> is needed to make client side validation work. The ref could be without URL (causes the javascript to be loaded as web resource) or with explicit url.

See attached example site. Jquery is registered in the Global.asax.cs.

The framework checks for existence of jquery. When validators are used also the WebUIValidation.js should be enforced when unobtrusive validation is turned on. Optionally enforce package like Microsoft.jQuery.Unobtrusive.Validation.

The framework components should work out of the box and warn for any dependancies not fulfilled.

Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

In VS2012 start empty web project in .net 4.5. Use validator.

Product Language

Dutch

Operating System

Windows 7 SP1

Operating System Language

Dutch

Actual results

No client side validation

Expected results

Client side validation out of the box
File Attachments
File Name Submitted By Submitted On File Size  
TestValidators.zip 2/15/2013 131 KB
Sign in to post a comment.
Posted by Willem-Derk Nijdam on 2/26/2013 at 12:11 AM
The problem is NOT jquery. Jquery is registered and available. See attachted example site. Check the commented section in Default.aspx. The problem is the missing validation javascript related to the validators. The validation script is available in the System.Web but is not loaded by the web browser unless explicitely referenced.
Posted by Microsoft on 2/25/2013 at 3:33 PM
This is because the JQuery hasnt been registered with the ScriptManager. You should install this "http://www.nuget.org/packages/AspNet.ScriptManager.jQuery/" Nuget package.
Posted by Microsoft on 2/19/2013 at 11:03 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 2/15/2013 at 1:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.