• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Code works if I use alert(), doesn't if I don't

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form that has a user choose a number of options from one list to populate a second list. In order to submit this second list, I select all the elements on submit. This works fine in Firefox and IE7, but not in IE6. I put a few alert() calls in the code to figure out what's happening and the code works! I've attached a simplified version of my code below. In IE6, only one field will be selected by clicking on the "select all 1" button. All the fields will be selected by clicking on the "select all 2" button (and the subsequent alerts).
Does anyone know what's going on here, or have a better way to go about this?


NOTE: onKlick misspelled above on purpose to get past the filter. Substitute "C" for "K".
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<button TYPE="button" onclick="selectAll_1(this.form); return false;">select all 1</button>

Eric
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't seem to make any difference, Eric. Still only selects one option in IE 6.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was just getting ready to say that if you make the select element multiple in the HTML code vs the javascript code, it would work but I didn't know why. Eric's response explains why.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey Joe,

Nice problem.

I tried (in IE6 and Firefox 2.0)

<select name="fields" size="10" multiple="multiple">

Herman
(only now I realize that this is probably Gregg's solution)
reply
    Bookmark Topic Watch Topic
  • New Topic