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

list box values

Guest
Aug 15, 2006 Aug 15, 2006

Copy link to clipboard

Copied

Hi i have 11 list boxes on the same page which the content is dynamic,

what i need is before the form is submited to check that the list boxes do not contain the same value as any of the others

so each list box value is unique, how would i go about doing this?
TOPICS
Advanced techniques

Views

577

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
Participant ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

maybe it's me but your posting makes no sense...

do you mean you have 10 form fields???

what kind of data is requested the fields?

why would they be similar???

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
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

ok i have 11 form drop down boxes in one form, so users can select 11 players from a main list but i dont want user to be able to submit 2 players the same

so in the 11 list boxes each one must have a different player

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
New Here ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

Hello richy2424,

use JavaScript. Here one example with 4 list boxes.

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
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

Thank you so much, just 1 question, i dont know much about javascript, just need to know what to change to add another listbox

to this code

many thanks

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
New Here ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

For more list boxes do this:

for(var i=1; i<5;i++) and for(var z=1; z<5 ;z++)

5 is count of listboxes + 1.
When you have 11 list boxes change 5 to 12.

Add select - formfields with self names (select5 , select6.....).
When you change the names of the boxes in the form, for example player1 - player11 , you must replace all 'select'+i to 'player'+i in the JavaScript function.

Sorry for my bad english :-)
Thomas

Text

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
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

ok thanks u beat me to it, i worked it out many thanks

just one quick one where the "else { alert("submit!");}" is how would i get this not to show a alert box but submit my form named "form3"

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
New Here ,
Aug 16, 2006 Aug 16, 2006

Copy link to clipboard

Copied

LATEST
Replace the alert statement with this:

document.forms['form3'].submit();

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