Solved

Another js question

Posted on 2004-03-25
5
243 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now