473,382 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

2-digit year dates not validated properly during client validation

I have noticed that CompareValidator and RangeValidator don't work properly
with 2-digit year dates when using client script validation. Specifically the
problem lies in the way the string is converted into a date before being
compared to the preset value(s). Normally (when using the default values:
CutOffYear=2029 and Century=2000) a 2-digit year, YY, should be converted to
20YY if YY<=29 and 19YY if YY>29. This is what happens if the validation is
done on the server, but when the validation is done on the client, the year
is always converted to 20YY (regardless of the value of YY).

I have tracked down the bug to WebUIValidation.js in function GetFullYear(...)
In line 183, the original code reads:
return (year + parseInt(val.century)) - ((year < val.cutoffyear) ? 0
: 100);
and since year is 2-digits it is always less than 100 which is less than
val.cutoffyear (=2029)
The correct code should read:
return (year + parseInt(val.century)) - ((year +
parseInt(val.century) <= val.cutoffyear) ? 0 : 100);

I can make this change myself but I have to do it on every client's server
where I install my applications and I also have to explain to the client why
I am tampering with the Framework code (not to mention that there may be
another application on the same server relying on this incorrect behaviour).
Dec 2 '05 #1
0 1203

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: arc | last post by:
I have a server object that performs zipcode validation based on zipcode entered in the web form. Ideally this should work as follows: Once the zip code is entered in the edit box it should...
5
by: Galen Harris | last post by:
I'm getting weird errors during transformations -- "System.Net.WebException. The remote server returned an error: (500) Internal Server Error." I'm on the 1.0 Framework. I've looked through...
1
by: Johny | last post by:
Hi....I have a problem with my asp page, when it have diferent controls and some validation control...but i want to validate just some controls if the user select a checkbox i have to control just...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
10
by: Tom | last post by:
I have created a new site, using asp.net c#. My pages contain client side validation to validate the users input. On my local machine this works fine, but when I moved my site to the test server,...
2
by: Fourge | last post by:
Hi, I have run into a very strange scenario. In developing an ASP.NET application on framework version 1.1, I found that certain client-side validation scripts were not being rendered. The...
8
by: John Dalberg | last post by:
I have an aspx page that was developed initially in Dreamweaver as a regular html file. I have added a few textboxes and required validators. The problem is that the client side validation is not...
3
by: Mr Newbie | last post by:
I am using a DataGrid for Edit and Update. However, Im wondering what the best strategy for client side validation would be as I dont think the validators can reference the TextBoxes which come up...
0
by: koen | last post by:
Hi! In asp.net (version 1.1) I run into a problem when trying to perform client validation. The error I get on the client-side is : "Error: expected ';'". This problem occurs when I place a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.