Solved

JS validation causes error when opening

Posted on 2004-03-24
4
255 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
It was the return true

Hey I learned something

Thanx

James
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now