Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7171903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:30:24+00:00 2026-05-28T15:30:24+00:00

Thanks to all the other SO questions regarding javascript and comparing dates, I was

  • 0

Thanks to all the other SO questions regarding javascript and comparing dates, I was able to come up with something that works well for my situation. Now, I just need to clear the input field if the date entered is more than 30 days old.

function ChngStatusEffective(obj)
{
  p=/(\d{1,2})\/(\d{1,2})\/(\d{1,4})/;
  if (!obj.value.match(p)) return;
  num=new Array();
  num=obj.value.match(p);
  if (num[1].length == 1) num[1]="0" + num[1];
  if (num[2].length == 1) num[2]="0" + num[2];
  if (num[3].length == 1) num[3]="200" + num[3];
  if (num[3].length == 2) num[3]="20" + num[3];
  strValue= num[1] + "/" + num[2] + "/" + num[3];

    var today = new Date ();
    var Date2 = new Date (strValue);
    var Days = Math.floor((Date2.getTime() - today.getTime())/(1000*60*60*24));
    alert('Days between two dates is: ' + Days);
    if (Days >= 0)
        {
            alert('Future dates are not allowed ' + Days);
            //  document.getElementByName('statuseffective').value();
            $('#stauseffective').val('');
            return false;
        }
    else if ((Days === -1) || (Days > -31))
        {
            alert('Date entered looks good'  + Days );
        }
    else 
        {
            alert('Are you sure you entered the correct date? ' + Days);
        }
validateUSDate( strValue )
}

The function is called:

<input type="text" name="statuseffective" onchange="ChngStatusEffective(this)" />

I need only this input field name, statuseffective to be blanked. NOTE: there could be one input field or there could be 100. I only need the one input field blanked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:30:25+00:00Added an answer on May 28, 2026 at 3:30 pm

    Since you are passing this to the ChngStatusEffective method you can use it to set its value.

    $(obj).val('');
    

    or

    obj.value = '';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks to all that responded to my previous thread. There is still a problem
First of all, I have gone through all the questions here regarding the inclusion
I recently asked this question: Expose XML or Objects - thanks all for the
thanks for all the help the last few days. I'm hoping someone knows this
First of all thanks in advance, this has been very frustrating and I'm hoping
first of all thanks for taking your time! I'm a junior Dev, working with
edit: many thanks for all the answers. Here are the results after applying the
First, thanks for all the help I've received so far from StackOverflow. I've learned
This is the last part of this project, thanks to all who've helped with
I am a newbie to VBS scripting. Thanks for all your comments! I fixed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.