Results 1 to 4 of 4
  1. #1
    SalientAnimal is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Angry Future Date Validation

    Hi All,

    I'm trying to get my Validation to check my calendar to ensure that the date being selected from the calendar is a future date.

    THe code I am currently using is:
    Java Code:
    var dateString = document.form1.date.value; 
    var myDate = new Date(dateString); 
    var today = new Date(); 
    if(document.forms.form1.date.value=="")
    {
    alert("Please select a date from the calendar.");
    document.forms.form1.date.focus();
    return false;
    } 
    else if (myDate<today) 
    {  
    alert("Please select a future date from the calendar.");
    document.forms.form1.date.focus();
    return false;
    }
    Unfortunatly it only validates the date, and not if the date captured is a future date. Ideally I would like it to check that the date selected is at least 29 days from the current date.

    Thanks

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    7

    Default Re: Future Date Validation

    This is a Java forum and not a Javascript forum. In fact, Java is to JavaScript as ham is to hamster.

  3. #3
    SalientAnimal is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: Future Date Validation

    Sorry, I'm pretty much self taught, so still trying to learn what is what. Sorry about that.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Future Date Validation

    Off topic, closing.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Date Validation
    By Gai-Sensei in forum New To Java
    Replies: 1
    Last Post: 02-08-2012, 10:12 PM
  2. Taking user input as a date and validation!
    By Junki3JJC in forum New To Java
    Replies: 3
    Last Post: 03-29-2011, 01:28 PM
  3. date validation
    By droidus in forum New To Java
    Replies: 5
    Last Post: 03-19-2011, 01:37 PM
  4. License date validation
    By thaneshkadi in forum Forum Lobby
    Replies: 0
    Last Post: 10-23-2009, 12:26 AM
  5. Date Validation Script
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-22-2008, 08:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •