Solved

JS validation causes error when opening

Posted on 2004-03-24
4
256 Views
Last Modified: 2013-12-18
case "Pending Approval" :
                                               TK = "Time Keeper Project Code/TKProjCode"
                                               if ( document.all.RequestType.value !== "RFA" )
                                              elseif( !RTGValidateForm(TK ) )
                    return false
               v = "Forecast Effort (mandays)/Effort, Proposal Valid Thru/DateValidThru, Scheduled Start/DateScheduledStart, Committed Delivery/DateCommittedDelivery, Engineering Group/EngineeringGroup"
               if ( document.all.RequestType.value == "Certification" ) v += ",Engineer Contact Name/CertEngineer,Engineer Contact Phone/CertPhone,Engineer Contact E-Mail/CertEmail"
               if ( !RTGValidateForm( v ) )
                    return false
               break
0
Comment
Question by:adspmo
  • 2
  • 2
4 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 10672070
Hi adspmo,
>                                               if ( document.all.RequestType.value !== "RFA" )
>                                               elseif( !RTGValidateForm(TK ) )


This looks wrong.  Here are the possible syntax variations for JS if statements:

if ( condition )
    single_statement


if ( condition ) {
    first_statement
    seoncd_statement
}


if ( condition )
    single_positive_statement
else
    single_negative_statment


And of course, single_positive_statement and/oor single_negative_sttament could easily be turned into multiple statements by replacing teh single statment with braces-enclosing-several.

So, first off, there is no statement after your if, so JS will think the elseif is supposed to be an exevutable statement.  Second, there should be a space between else and if, because JS doesn't use elseif.

Cheers!
0
 

Author Comment

by:adspmo
ID: 10672234
Ok I tried to slim it down. Myintent is to validate all forms but the RFA=Problem Rpt
Case: Pending Approval
  if ( document.all.RequestType.value == "RFA-Problem Rpt" )
                                      if ( !RTGValidateForm() )
                        return false      
                  v = "Forecast Effort (mandays)/Effort, Proposal Valid Thru/DateValidThru, Scheduled Start/DateScheduledStart, Committed Delivery/DateCommittedDelivery, Engineering Group/EngineeringGroup,Time Keeper Project Code/TKProjCode"
                  if ( document.all.RequestType.value == "Certification" ) v += ",Engineer Contact Name/CertEngineer,Engineer Contact Phone/CertPhone,Engineer Contact E-Mail/CertEmail"
                  if ( !RTGValidateForm( v ) )
                        return false
                  break
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
ID: 10672495
adspmo,
Just look at your structure!

If RFA then
    if not valid Then
        return false
    end if
end if

That ONLY validates the RFA, the opposite of what you said!

I think you want something like:

If RFA Then
    return true


'Now we know we are not RFA, so validate
v = "list of fields to validate"
etc.

Also, I don't understand the RTGValidateForm function.  You have it called both with and without a parameter.  I assume that when you pass it a parameter, it assumes the parameter to be a string it can split at comma, and take each value and check whether it was filled in or not.
0
 

Author Comment

by:adspmo
ID: 10673429
It was the return true

Hey I learned something

Thanx

James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

23 Experts available now in Live!

Get 1:1 Help Now