1

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;
}
PositiveGuy
  • 46,620
  • 110
  • 305
  • 471
  • I would look into the parts in the if statements more closely! – Mahesh Velaga Apr 22 '10 at 21:32
  • my fault. I had a comment right on the same line as one of my if statements..you can't do that unfortunately and I hate that. That was the problem that you would not have seen here. – PositiveGuy Apr 23 '10 at 14:12

3 Answers3

2

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

PositiveGuy
  • 46,620
  • 110
  • 305
  • 471
  • Well that's odd, is that correct Javascript behaviour? Congrats anyway :) – CiscoIPPhone Apr 23 '10 at 14:15
  • yea, same for C#. You cannot comment on the same line as your if or else, and so fourth. – PositiveGuy May 07 '10 at 03:18
  • Amazing! "Expected expression: ." and "Expected identifier: ." were driving me mad, appearing after a gulp bundle/minify just for two of the bundles, only on the first build & run after modifications (VS2019). Turns out one of the source files had a comment on the same line as an if statement and moving that solved it. I have no idea why it works after the first build when running the task manually but I hope this helps someone else who was going as mad as I was. NB file compare of the bundled & minified output from a "good" run with a "bad" run didn't show a single difference. – Jon Dec 04 '20 at 15:57
0

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
  • 272,464
  • 47
  • 358
  • 399
0

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
  • 1,740
  • 28
  • 36