Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JS validation causes error when opening

Posted on 2004-03-24
4
Medium Priority
?
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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 Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

705 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