Skip to main content
Known Participant
February 19, 2010
Question

how to made this in coldfusion

  • February 19, 2010
  • 4 replies
  • 1119 views

Hi

users must have the ability to select multiple options from dropdown  when generating reports .  In addition, the user must have the ability to see which options  were selected prior to generating the report.

Thanks,

This topic has been closed for replies.

4 replies

Participating Frequently
February 24, 2010

Try what I have below.  Pretty sure its what's you are try to do.  Hope this helps.  If it answers your question please mark as so, I'm new to these forums and I'd like to generate some points.

<script>
function myFunc(obj)
{
  document.getElementById('mySpan').innerHTML=''; //blank it out
  //loop through the options
  for (i=0; i <= obj.options.length - 1; i++)
  {
   if (obj.options.selected)
   {
    if (document.getElementById('mySpan').innerHTML == '') //first one, don't lead with comma
     document.getElementById('mySpan').innerHTML=obj.options.value;
    else
     document.getElementById('mySpan').innerHTML=document.getElementById('mySpan').innerHTML+', '+obj.options.value;
   }
  }
}
</script>

<select name="test" id="test" multiple="true" size="10" onclick="myFunc(this)">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
<option value="5">Five</option>
<option value="6">Six</option>
<option value="7">Seven</option>
<option value="8">Eight</option>
<option value="9">Nine</option>
<option value="10">Ten</option>
</select>
<br>
You have selected: <span id="mySpan"></span>

cfnewAuthor
Known Participant
February 24, 2010

hi thanks for ur help but when i copied this in my local system it is not working and when i select options i am not able to see at bottom

please check this once thanks

cfnewAuthor
Known Participant
February 24, 2010

i got that by using multiple options but i need to show user which options user selected just below that drop down

Participating Frequently
February 23, 2010

In addition to the multiple setting you may want to use size="10", then maybe a note to the side of the field letting the user know they can select multiples by holding down the "Ctrl" key.

Inspiring
February 19, 2010

Personally I prefer checkboxes but,

<select multiple="multiple">