function ValidatorConvert(op, dataType, val) {
function GetFullYear(year) {
return (year + parseInt(val.century)) - ((year < val.cutoffyear) ? 0 : 100);
}
var num, cleanInput, m, exp;
if (dataType == "Integer") {
}
else if(dataType == "Double") {
}
else if (dataType == "Currency") {
}
else if (dataType == "Date") {
var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})\\s*$");
m = op.match(yearFirstExp);
var day, month, year;
if (m != null && (m[2].length == 4 || val.dateorder == "ymd")) {
day = m[6];
month = m[5];
year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10))
}
else {
if (val.dateorder == "ymd"){
return null;
}
var yearLastExp = new RegExp("^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$");
m = op.match(yearLastExp);
if (m == null) {
return null;
}
if (val.dateorder == "mdy") {
day = m[3];
month = m[1];
}
else {
day = m[1];
month = m[3];
}
year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10))
}
month -= 1;
var date = new Date(year, month, day);
return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null;
}
else {
return op.toString();
}
}
So it uses a javascript Regular Expression ( RegExp ) function to determine the date format for validation. Obviously this does not like the DD-MMM-YYYY format used in DotNetNuke. However it would probably be a simple task for a Regular Expression expert to make this function more robust ( if someone could break down the RegExp specifications in this function to plain English I would be happy to share with the community ).
However, the bigger issue is how to fix this in an individual application. You should NOT be changing the WebUIValidation.js stored in the default location as it affects ALL ASP.NET applications and could cause issues. You want your changes to stay local to the current application.
- Create a folder in your project directory called WebUIValidation
- Copy WebUIValidation.js, SmartNav.js, and SmartNavIE5.js from the default location to /WebUIValidation
- Make the necessary changes to the .js file(s)
- Add the following tag to web.config:
<webControls clientScriptsLocation="/WebUIValidation/" />