Hi All,

I've written a function in VBScript that runs as part of a web
application in IE. But, IE keeps telling me there's a syntax error.
But for the life of me I don't see it. I've marked the line
accordingly. Any help would be appreciated.

TIA.


Function EAAFOnSubmit( strAction )
addNew = 0

document.myForm.all("SALUTATION_ID").value =
document.SALUTATION_IDFrame.SALUTATION_ID.value

document.myForm.all("PRSN_TYP_CD").value =
document.PRSN_TYP_CDFrame.PRSN_TYP_CD.value

document.myForm.all("ARL_TITLE_ID").value =
document.ARL_TITLE_IDFrame.ARL_TITLE_ID.value

document.myForm.all("RANK_ID").value =
document.RANK_IDFrame.RANK_ID.value

document.myForm.all("myFormSubmitted").value = strAction

If StrComp( strAction, "Close", VBTextCompare ) <> 0 Then
If not EAAFValidate( strAction ) Then
Exit Function
End If
End If

If StrComp( strAction, "Update Record", VBTextCompare ) = 0 OR
StrComp( strAction, "Update and Close", VBTextCompare ) = 0 OR
StrComp( strAction, "Add New Record", VBTextCompare ) = 0 Then
document.myForm.submit
Exit Function
End If <<< ERROR IS HERE SUPPOSEDLY

If StrComp( strAction, "Close", VBTextCompare ) = 0 AND addNew = 1
Then
opener.document.location = document.myForm.all("capturedURL") &
"&onAddEmployee=CLOSEDELETE_" & document.myForm.all( "titleID" ).value
Else
opener.document.location = document.myForm.all("capturedURL") &
"&onAddEmployee=" & document.myForm.all( "titleID" ).value
End If
window.close

End Function

Re: Syntax Error ??? by rnurse

rnurse
Fri Sep 10 07:49:45 CDT 2004

Hi Malc,

This function serves as the onSubmit even handler in a web
application. It either submits the form if everything is OK or it
doesn't. I'll try putting that If statement on one line and see what
happens. Our development server is down for the next few minutes. So
I won't know for a while.

As you can imagine, I'm new to VBScript. I took over development of
this portion of the application from a VBScript enthusiast.


mksmith@cix.compulink.co.uk (Malcolm K Smith) wrote in message news:<memo.20040910003812.5300E@mksmith.aits-uk.net>...
> In article <a967f5b9.0409091207.79773f47@posting.google.com>,
> rnurse@cudbytech.net (Robert Nurse) wrote:
>
> > If StrComp( strAction, "Update Record", VBTextCompare ) = 0 OR
> > StrComp( strAction, "Update and Close", VBTextCompare ) = 0 OR
> > StrComp( strAction, "Add New Record", VBTextCompare ) = 0 Then
> > document.myForm.submit
> > Exit Function
> > End If <<< ERROR IS HERE SUPPOSEDLY
>
> Have you put this pile of If statements onto one line or used Line
> Continuation characters? This may be the problem.
>
> As a matter of interest, what will the function return at this point? I
> always try to have one exit point from a routine and if it is a function I
> try to ensure that it returns something.
>
> - Malc

Re: Syntax Error ??? by rnurse

rnurse
Fri Sep 10 14:12:11 CDT 2004

Malc,

You were right. It didn't like that If statement broken up on
multiple lines. I checked MS site and there's a line continuation
character set I should have used. After putting the If statement on
one line, everything worked great.

Thanks.