Solved

Another js question

Posted on 2004-03-25
5
247 Views
Last Modified: 2013-12-18
HI Guys

I have this javascript that I have modified from anothe r function
What it need to do is two things,if the dateEstBetaCOmp is blank then validate, which it does, however I am also trying to check if the date entered is in the past I want the message to popup only when switching to beta

 v = "Estimated Beta Completion/DateEstBetaComp"
            if ( !RTGValidateForm( v ) )
            return false
                                       break      

today = new Date();
      day = today.getDate();
      month = today.getMonth();
      month++;
      year = today.getFullYear();

year = parseInt( year, 10 )
      month = parseInt( month, 10 )
      day = parseInt( day, 10 )
      var B = dateToIso( (day < 10 ? "0" : "") + (day + "") + monthShortName[month] +  (year + "").substring(2))
                var d4 =  dateToIso(document.all.DateEstBetaComp.value)
var b = true

     if ( d4.length > 0 && d4 < B )

                               {
                b = false
               msg = "Estimated Beta Completion Date entered cannot be in the past, please enter a new date"
                                 }

              if ( b == false )
      {
             alert("DATE INCONSISTENCY:  \n\n" + msg)
            return false
      }
      else return true      
0
Comment
Question by:adspmo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 10679274
easier if you always use JS date object
0
 

Author Comment

by:adspmo
ID: 10679306
I cannot do that

This is an existing script and function set that I have to keep using
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 350 total points
ID: 10679345
use something similar to this condition

document.all.DateExtBetaComp.value < today && document.all.Status.value = "Beta"

add this to the existing if condition

~Hemanth
0
 

Author Comment

by:adspmo
ID: 10679362
I am thinking it is a bracket placement or something of that nature on there own the y work I need to combine for validation
case "Beta": This works
v = "Estimated Beta Completion/DateEstBetaComp"
          if ( !RTGValidateForm( v ) )
          return false
                                       break    

This works as part of another function  
today = new Date();
     day = today.getDate();
     month = today.getMonth();
     month++;
     year = today.getFullYear();

year = parseInt( year, 10 )
     month = parseInt( month, 10 )
     day = parseInt( day, 10 )
     var B = dateToIso( (day < 10 ? "0" : "") + (day + "") + monthShortName[month] +  (year + "").substring(2))
                var d4 =  dateToIso(document.all.DateEstBetaComp.value)
var b = true

     if ( d4.length > 0 && d4 < B )

                               {
                b = false
               msg = "Estimated Beta Completion Date entered cannot be in the past, please enter a new date"
                                 }

            if ( b == false )
     {
           alert("DATE INCONSISTENCY:  \n\n" + msg)
          return false
     }
     else return true    

0
 

Author Comment

by:adspmo
ID: 10681147
Here is what I came up with

  if ( d4.length > 0 && document.all.RequestStatus.value !== "Beta"&& d4 < B )
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question