• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

javascript bit challenge

Guest
Sep 15, 2006 Sep 15, 2006

Copy link to clipboard

Copied

I have lists of name comming from db

Firstname
John,
Kamal,
ABC
SYSE
etc
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
TOPICS
Advanced techniques

Views

303

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 15, 2006 Sep 15, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 16, 2006 Sep 16, 2006

Copy link to clipboard

Copied

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 17, 2006 Sep 17, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 17, 2006 Sep 17, 2006

Copy link to clipboard

Copied

LATEST
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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation