3 Replies Latest reply on Mar 20, 2007 10:49 AM by Newsgroup_User

    Help with If and alert box

    ajrobson Level 1
      I have a script which returns a list i want to make sure the list is bigger then and smaller or equal to 7, if it failes either of these i want a alert box to pop up below is some code i have come up, the list is a list of which checkboxes are hitlite it works if i pick none the alert about picking at least one comes up, but if i pick just one box i get the other alert sayin i can only pick 7, can anybody tell me why? Below is the entire mouseup handler that i am using
        • 1. Re: Help with If and alert box
          Level 7
          if chosenBoxes is a list then it seems you're more interested in the count
          of that list than if it equals another list ([1], or [7]). I believe the
          changes I made to your code should do the trick. I also assumed that you
          want your query to only execute when the list count is more than 0 or less
          than or equal to 7.

          >I have a script which returns a list i want to make sure the list is bigger
          > then and smaller or equal to 7, if it failes either of these i want a
          > alert box
          > to pop up below is some code i have come up, the list is a list of which
          > checkboxes are hitlite it works if i pick none the alert about picking at
          > least
          > one comes up, but if i pick just one box i get the other alert sayin i can
          > only
          > pick 7, can anybody tell me why? Below is the entire mouseup handler that
          > i am
          > using
          >
          > on mouseUp me -- on mouse click
          > choosenBoxes = me.CheckBoxState() -- chosenboxes is a variable calls the
          > handler on it
          >
          > if choosenBoxes.count < 1 then
          > alert("you have to pick one film")
          > else
          > if choosenBoxes.count > 7 then
          > alert("You can only pick a Maximum of 7 films")
          > else
          > SQL = "Select * from BoxOffice where title in(" &&
          > parseListToString(choosenBoxes) && ")"
          > err = _global.myDB.executeSQL(SQL)
          > end if
          > end if
          >
          > end
          >


          • 2. Help with If and alert box
            ajrobson Level 1
            thanks, i also had a script to go to the next marker attached to the same sprite but no matter how many boxes are checked it would still go to next, i tried this code below, but it still does the same if i press 8 boxes it still goes to the next marker, how come the last if statement gets executed if the other conditions are true?

            SORRY THIS MESSAGE CAN BE IRGNORED I HAD A INCORRECT VALUE IN LIST IT WORKS FINE NOW THANKS
            • 3. Re: Help with If and alert box
              Level 7
              You need to see what the choosenBoxes list looks like. It certainly isn't
              what you're expecting.

              Try using the debugger...click in the left margin on the line number next to
              the first if statement so that a red dot appears. Then exectute the code
              and when the debugger opens look for the value of choosenBoxes and count the
              number of items.
              --
              Craig Wollman
              Lingo Specialist
              Word of Mouth Productions
              212-928-9581

              www.wordofmouthpros.com
              "ajrobson" <webforumsuser@macromedia.com> wrote in message
              news:etoltb$jhi$1@forums.macromedia.com...
              > thanks, i also had a script to go to the next marker attached to the same
              > sprite but no matter how many boxes are checked it would still go to next,
              > i
              > tried this code below, but it still does the same if i press 8 boxes it
              > still
              > goes to the next marker, how come the last if statement gets executed if
              > the
              > other conditions are true?
              >
              > on mouseUp me -- on mouse click
              > choosenBoxes = me.CheckBoxState() -- chosenboxes is a variable calls the
              > handler on it
              >
              > if choosenBoxes.count < 1 then
              > alert("you have to pick one film")
              > else
              > if choosenBoxes.count > 7 then
              > alert("You can only pick a Maximum of 7 films")
              > else
              >
              > SQL = "Select * from BoxOffice where title in(" &&
              > parseListToString(choosenBoxes) && ")"
              > err = _global.myDB.executeSQL(SQL)
              > go next -- go to next marker
              > end if
              > end if
              >
              > end
              >