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

x
?
Solved

JS validation causes error when opening

Posted on 2004-03-24
4
Medium Priority
?
264 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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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.
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Loops Section Overview
Suggested Courses

885 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