5 Replies Latest reply on Jul 23, 2007 1:13 PM by kglad

    preventing entry duplication in string

    phil1943 Level 1
      Hello, I have a page of checkboxes.
      When each checkbox is clicked I want a unique value entered into a string. The string should build up as multiple checkboxes are clicked (the string wil then be submitted to coldfusion for a database search).
      I set up the below, however the "+=" operator duplicates previous string entries. How can I overcome this duplication ?
      ...or perhaps I have gone about the wrong way to perform this ?
      Thanks in advance for any help.

      RELEVANT CODE SEGMENT:
      var selections:String = "";
      myCheckboxListener.click = function() {
      if (checkbox1.selected) {
      selections += "tanks";
      }
      if (checkbox2.selected) {
      selections += "aircraft";
      }
      }

      submitbutton.onRelease = function (){
      trace (selections);
      }