Using MicrosoftMvcValidation.js for client-side validation, is there an easy way to programmatically (in javascript) disable and enable validation for certain fields?
Is it possible, for example, to use jquery to bind / unbind events?
Imran Belukh's blog has your answer:
http://weblogs.asp.net/imranbaloch/archive/2010/06/20/disabling-client-side-validation-for-disabled-input-controls-in-asp-net-mvc.aspx
It includes customization in MicrosoftMvcValidation.debug.js
Change this:
if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(errorMessage)) { Array.add(errors, errorMessage); }
To that:
var inptEl = $get(context.fieldContext.elements[0].id); if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(errorMessage) && !inptEl.disabled) { Array.add(errors, errorMessage); } else Sys.UI.DomElement.removeCssClass(inptEl, Sys.Mvc.FieldContext._inputElementErrorCss);
Source: https://habr.com/ru/post/1746297/More articles:Trac: Pending plugin? - tracCan SQL Server 2008 use a variable in a WHERE IN clause - sqlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1746294/how-do-i-add-controls-other-than-buttonsactions-to-toolbars-in-qt-such-as-text-boxes-and-combo-boxes&usg=ALkJrhiv7rm5zgm8XdSitMCzjOesmdWPiwWPF data binding update comboxbox2 based on selection change in combobox1 with MVVM - data-bindingIf I add a public method to a C # class, do I need to recompile other assemblies using this type? - publicDeveloping an application for the iPhone, how to get the video “length” from the video saved in my application docs folder? - objective-cIdiomatic ruby for temporary variables inside a method - scopeMySQL - Как преобразовать data_length в фактический размер? - mysqlPostgreSQL inserts an error on the primary key, even at the serializable level - postgresqlXML template engine in Java? - template-engineAll Articles