date field

How do I prevent a date field mmddyy from accepting a past year.  right now, the ui (jsp) does not accept a past date if it is the current year, but if you put a date with a past year, it accepts.  Thanks.
shwelopoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Code?

Output?
0
shwelopoAuthor Commented:
Attached is the jsp
0
shwelopoAuthor Commented:
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Michel PlungjanIT ExpertCommented:
What is
history.forward();
doing for you?

Anyway. Your date picker is ancient. Also you are deep linking Matt's JS file - that is not nice.

You can get a much more refined one using jQuery UI

Is that an option?

Also most of the code is non-optimal. Have you considered rewriting it?
There is a LOT of inline script that does not belong there.
0
shwelopoAuthor Commented:
I did not write the original script.  I spent most of my time converting neat-3 and or cobol/mainframe programs to pc-based platform.  I was asked to fix this date issue as the person is no longer there.  the problem here is these people have customized everything from a while back to fit their customized programs.  If you can help me fix the date issue and modify the script to make it better, I'm all for it.  Jquery is an option.  Thank you.
0
Michel PlungjanIT ExpertCommented:
Ok, I'll see what I can do
Please note experts are unpaid volunteers
0
shwelopoAuthor Commented:
much appreciated.
0
Michel PlungjanIT ExpertCommented:
Wow. Very poor code.

For example

    checkDate = document.mainForm.first_Date.value
    checkDate = document.mainForm.reterm2_Date.value
    checkDate = document.mainForm.reterm3_Date.value
    checkDate = document.mainForm.reterm4_Date.value
    checkDate = document.mainForm.reterm5_Date.value
    checkDate = document.mainForm.reterm6_Date.value
    checkDate = document.mainForm.reterm7_Date.value
    checkDate = document.mainForm.reterm8_Date.value
    checkDate = document.mainForm.reterm9_Date.value

after all this only the last is tested.

but the function it is in is never called so unless there is an include I am missing, such as
<%@ include file="countryNumber.html" %>
 this code can be deleted

  function check_DateOrder(dateVal) {
    var inputDate = dateVal.value;
    inputYear = inputDate.substring(6,8);
    inputDay = inputDate.substring(3,5);
    inputMonth = inputDate.substring(0,2);
    var checkDate = "";
    checkDate = document.mainForm.first_Date.value
    checkDate = document.mainForm.reterm2_Date.value
    checkDate = document.mainForm.reterm3_Date.value
    checkDate = document.mainForm.reterm4_Date.value
    checkDate = document.mainForm.reterm5_Date.value
    checkDate = document.mainForm.reterm6_Date.value
    checkDate = document.mainForm.reterm7_Date.value
    checkDate = document.mainForm.reterm8_Date.value
    checkDate = document.mainForm.reterm9_Date.value
//    checkDate = document.mainForm.reterm10_Date.value
//    var today = new Date();
    todayMonth = checkDate.substring(0,2);
    todayDay = checkDate.substring(3,5);
    todayYear = checkDate.substring(6,8);
    var errorFlag = false;
    if (todayYear < inputYear && inputYear < 50) { errorFlag = true }
    if  ((todayMonth < inputMonth) && (todayYear == inputYear)) { errorFlag = true }
    if  ((todayDay < inputDay) && (todayMonth == inputMonth) && (todayYear == inputYear)) {
      errorFlag = true
    }
    if (errorFlag == true) { 
      alert('Date entered is future date - invalid entry.') 
      dateVal.focus();
      dateVal.select();
    }
  } 

Open in new window

0
Michel PlungjanIT ExpertCommented:
Please post

countryNumber.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.