Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Another js question

Posted on 2004-03-25
5
Medium Priority
?
250 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 1400 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

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…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview

886 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