4 Replies Latest reply on Sep 17, 2006 6:02 PM by azadisaryev

    javascript bit challenge

    Nick201 Level 1
      I have lists of name comming from db

      When I select John i won't able to access any other names
      when select any other names I won't able to select john.
      I can select multiple names same time . but dispable John at that time

      for example I select ABC ,KAMAL etc same time then disable jojn
      when I select John then disable all other names.
      I cant use radio button because i want to select multiple names thanx
        • 1. javascript bit challenge
          jdeline Level 1
          A simple way to accomplish this is to use a SELECT box with MULTIPLE enabled. Selecting a name disables whatever may have been selected. Holding down CTRL key allows you to select multiple names, deselecting any that may have been selected. See concept code below.
          • 2. Re: javascript bit challenge
            azadisaryev Level 1
            i am afraid jdeline did not understand the problem at hand here... sure, the example is a good one of the use of populating select boxes with query results, but it does not show how to achieve what Nick201 want to achieve.

            if i understand you correctly, Nick201, you need to be able to select multiple entries in your selectbox. if one of the selected entries is 'John', you need to un-select any other selected entries. if 'John' is selected, and then another selection is made, you need to un-select 'John'. am i correct?

            you do need to do it through javascript. let me know if i understand you right and i will post some code for you. you can do it with either select box or checkboxes (whihc i think will be easier as their values are easier to parse).
            • 3. javascript bit challenge
              jdeline Level 1
              Sorry, Sabaidee, but my concept code does exactly what you saidNick201 wanted to do. Note the MULTIPLE attribute in the <SELECT> statement.

              Select John deselects anything else that had been selected. Selecting Bill deselects John. Hold down the Ctrl key allows Pam and Harry to be selected also.
              • 4. Re: javascript bit challenge
                azadisaryev Level 1
                sorry, jdeline, but i still do not agree... just having MULTIPLE attribute does not solve Nick20's problem since it will still be possible to have John selected together with other names in the list. Your code, without any additional javascript, does not prevent selecting John AND other names while holding down Ctrl key.

                I also think Nick20 has posted the same question in the "Getting Started" forum, where it has already been answered...