16,011,626 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10549164 (Top 8 by date)
Member 10549164
6-Feb-20 12:05pm
View
Hi Richard,
Can I please get the min.js code of following jquery.validate.unobtrusive.js code
1) error.text(error.text().substr(error.text().indexOf("|") + 1));
because I am not finding the equivalent function to .text in the intellisense in min.js file.
Member 10549164
6-Feb-20 11:54am
View
Thanks a ton Richard, The min file was not having the update.
I want to let you know what's happening on server.
The build pushed both files out to the server. By default it attempted to load the min file which didnt have the modification. When I removed the min file from the solution on Dev the code is working perfectly. I am surprised that locally our machine is taking the regular file over the min file.
So locally it was taking regular file and on server its loading from min.js..
Thanks a lot again. I will update the min file.
Member 10549164
6-Feb-20 11:21am
View
Thank You. I will check on server and update which version of script is loaded on server.
Member 10549164
6-Feb-20 11:01am
View
Hi Richard,
Thank you. I accidentally pasted in the solution part., also when I am trying to delete, the whole post is getting deleted.
Member 10549164
6-Feb-20 10:49am
View
The tag is disappearing in the line for some reason.
My question again..can you please let me know why the '|' symbol ()in the validation message) is not being replaced when deployed on servers. It is replaced correctly when run in local host.
Member 10549164
6-Feb-20 10:45am
View
Yes. thanks what you have assumed is correct.. Iam trying to paste the line again down here
$("").html(this.message.replace('|', '')).appendTo(list);
Member 10549164
6-Feb-20 10:21am
View
Hi Richard,
Please find code in jquery.validate.unobtrusive.js file.
\\\
(function ($) {
var $jQval = $.validator,
adapters,
data_validation = "unobtrusiveValidation";
function setValidationValues(options, ruleName, value) {
options.rules[ruleName] = value;
if (options.message) {
options.messages[ruleName] = options.message;
}
}
function splitAndTrim(value) {
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
}
function escapeAttributeValue(value) {
// As mentioned on http://api.jquery.com/category/selectors/
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
}
function getModelPrefix(fieldName) {
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
}
function appendModelPrefix(value, prefix) {
if (value.indexOf("*.") === 0) {
value = value.replace("*.", prefix);
}
return value;
}
function onError(error, inputElement) { // 'this' is the form element
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
container.removeClass("field-validation-valid").addClass("field-validation-error");
error.data("unobtrusiveContainer", container);
if (replace) {
container.empty();
error.removeClass("input-validation-error").appendTo(container);
}
else {
error.hide();
}
error.text(error.text().substr(error.text().indexOf("|") + 1));
}
function onErrors(event, validator) { // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
if (list && list.length && validator.errorList.length) {
list.empty();
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
$.each(validator.errorList, function () {
$("").html(this.message.replace('|', '')).appendTo(list);
});
}
}
function onSuccess(error) { // 'this' is the form element
var container = error.data("unobtrusiveContainer"),
replaceAttrValue = container.attr("data-valmsg-replace"),
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
if (container) {
container.addClass("field-validation-valid").removeClass("field-validation-error");
error.removeData("unobtrusiveContainer");
if (replace) {
container.empty();
}
}
}
\\\
Member 10549164
5-Feb-20 15:56pm
View
Its not throwing any error. But the jquery code above, to replace the '|' char to ' ' is not working. The message "Chief Executive - |Name is required" is displayed in validation summary as well as beside textbox.
Show More