Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Multiple Select with Drop-Down?  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to provide a html form element for a Sales Rep selection. Choices can be All, Single, or Multiple Selection. The form, due to constraints, can only show size=1. There are over 170 Sales Reps, so I need to control the size of the drop down but haven't seen code on how to do that? Also, I am basically confused on how to employ some of the javascript I have seen online.

Currently:
<SELECT name="select1" multiple size=1>
<OPTION>test1</OPTION>
<OPTION>test2</OPTION>
<OPTION>test3</OPTION>
<OPTION>test4</OPTION>
<OPTION>test5</OPTION>
<OPTION>test6</OPTION>
<OPTION>test7</OPTION>
<OPTION>test8</OPTION>
<OPTION>test9</OPTION>
<OPTION>test10</OPTION>
<OPTION>test11</OPTION>
<OPTION>test12</OPTION>
<OPTION>test13</OPTION>
<OPTION>test14</OPTION>
<OPTION>test15</OPTION>
<OPTION>test16</OPTION>
</SELECT>

Can someone provide suggestions and/or point me to a more illuminating example online? I may have some followup questions as I have not used javascript much before.

Thanks tons in advance!

JD
 
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
control the size of the drop down....what in the world does that mean?

Eric
 
JD Thompson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Eric,

Sorry for a lack of clarity. I need a drop down list to display 15 names in a scrolling format of the 170 possible Sales Rep. What I need is the following:

1. on form, without focus, size of window=1
2. multiple select
3. when selecting multiples, viewing the different choices in a drop-down the size of 15 names.

I apologize if I was not clear on this point. I am working under a deadline on a team project and have been asked to pick up the report function which includes the web presentation/parameter gathering. I earnestly have been trying to research code online that accomplishes the above things but all I seem to find are the two-tier examples. I may have found an example but my newness to javascipt may have prevented recogniztion.

Please accept my sincere thanks again for whatever help/direction/pointers you are willing to offer.

Take care and have a great day!

JD
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you want to change the size when the user focus on it?

<select onfocus="this.size = '15';" onblur="this.size = '1';"

Now this will screw up your layout since it will expan in place. Only way to avoid that would be to absolute position it with a z-index > 1

Eric
 
JD Thompson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply Eric.


You are right, the display design is thwarted. I tried the zIndex=5.

When I have a <Select size=1>, there is a dropdown list that appears. However with <Select size=1 multiple> I do not get one, rather scroll bars. What type of javascript coding do I need to look at in order to combine the two? (Please remember I am new as of Monday to javascript, I am not asking someone to code this for me, but detailed direction would be extremely helpful) My guess would be:

<Select onFocus=someScriptName(this) onSelect=selectStatus(passSelection)
size=1 multiple>

javascript
================================
var selectArray //create a 2 x 170 array to hold [names,selection status]

function someScriptName(passedSelectElement)
{
iterated through the passedSelectElement to populate selectArray
get x,y positioning from passedSelectElement
open new window (size big enough to hold 15 entries)
position window at x-passedSelectElement.height,y
make window scrollable
make window visible
}

function selectStatus(passedSelectElement)
{
iterate through selectArray for passedSelectElement
set element to [name,true]
}

Am I on the right track or building a mansion to house a dog?

Thanks again for your help!

JD
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!