Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Script Problem

  • 26-07-2004 04:49PM
    #1
    Closed Accounts Posts: 537 ✭✭✭


    ListBox1.RemoveAll();
    var i ;
    Var Max = ActiveDocument . Sections ["Results"].Columns.Count ;
    For ( i=1 ; i <= Max ; i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }

    Syntax error in line 3 somewhere
    Can anyone see it


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Sections["Results"]
    may need to be
    Sections

    Also, last line, should
    Sections["Results"]columns
    not be
    Sections.columns

    If that's a copy and paste from your code, then tidy up your whitespace before debugging :)


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    I dont know what the story is with it i took it straight out of a book


    ListBox1.RemoveAll();
    var i;
    Var Max=ActiveDocument .Sections ["Results"].Columns.Count ;
    For ( i=1 ; i <= Max ; i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }

    Even though i changed it to single quotes the same error persists
    Missing ; before statement in line 3


  • Moderators, Politics Moderators, Paid Member Posts: 44,058 Mod ✭✭✭✭Seth Brundle


    is your listbox named Listbox1?
    Is there a space between on either side of the '.' on line 3 --> ActiveDocument . Sections


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Originally posted by kbannon
    is your listbox named Listbox1?
    Is there a space between on either side of the '.' on line 3 --> ActiveDocument . Sections
    Yeah, definitely those spaces causing the problem if that's a cut-and-paste from your code.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    ListBox1.RemoveAll();
    var i;
    var Max=ActiveDocument.Sections["Results"].Columns.Count;
    For (i=1;i<=Max;i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }


    It was a capital V in var Max that was the problem

    However now there is a missing ")" after argument list in line four


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    ActiveDocument.Sections["Results"]dotcolumns.Name


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    If i take out the dot i get the original error
    If i leave in the dot i get the latter error


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    Post up or attach the full page there.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    I cant its not a web page it is a reporting tool called BRIO


    I am simply trying to populate a combo box with values and that is all the code that is there


  • Moderators, Politics Moderators, Paid Member Posts: 44,058 Mod ✭✭✭✭Seth Brundle


    1. in the code there should be no spaces on either side of the dots
    2. change For to for (lower case)


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,209 ✭✭✭oneweb


    I'm open to correction on this but aren't variables supposed to start with lowercase and functions uppercase?

    listBox1.RemoveAll();
    var i;
    var max=activeDocument.sections["Results"].columns.count;
    for (i=1;i<=Max;i++)
    {
    listBox1.add(activeDocument.sections["Results"].columns.name);
    }

    ...also is this just a 'Programming JavaScript for IE' thing or will it work cross-browser? The capitalisation bangs of VBScript.

    It is what it's.



  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    Just a quick Query


    "].columns.name);


    Is this .name thing supposed to be the name of the column you should be querying


Advertisement