tags:

views:

52

answers:

3

I cannot figure out what I did or did not do here syntactically to cause this error. I don't see what's missing:

function ShowWaitMessage(button)
{
    var isValid;

    if (buttonSelected())
    {
        showWaitMessage(button, "showMessage1");
        isValid = true;
    }
    else
    {
        Page_ClientValidate();
        if (Page_IsValid)
        {
            showWaitMessage(button, "showMessage2");
            isValid = true;
        }
    }

    return isValid;
}
A: 

I don't think there's anything syntactically wrong with your code, having "run" it in both FireFox and IE. (By "run" I mean "loaded in a <script> tag", which ought to find syntax errors.)

What line does the error message point to?

RichieHindle
line is return isValid;
CoffeeAddict
A: 

You're missing a declaration of the Page_IsValid variable. I'm guessing that it's a local variable set inside of Page_ClientValidate, which isn't in scope in this function?

You should probably also initialize isValid to false instead of leaving it undefined if both checks fail.

Hellion
A: 

I had a comment on the same line as one of my if statements....causing this whole issue.

CoffeeAddict
Well that's odd, is that correct Javascript behaviour?Congrats anyway :)
CiscoIPPhone
yea, same for C#. You cannot comment on the same line as your if or else, and so fourth.
CoffeeAddict