Copy link to clipboard
Copied
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,
Copy link to clipboard
Copied
Personally I prefer checkboxes but,
<select multiple="multiple">
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i got that by using multiple options but i need to show user which options user selected just below that drop down
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
sorry thanks for ur help its working now i will try now and see
Thanks
Copy link to clipboard
Copied
hi your answer helps me a lot but in my drop down box i had check boxes to select these options for this how to implement this javascript , i am not able to get this logic here is code below, where the select box is written in custom tags that will generate dropdown
<cf_dsp_select query="#qry#" onclick="myFunc(this)" multiple="true" size="5" label_class="required" validation="checkRequired(this)"
label="Div" name="my_no" value="my_no" text="$my_no$ " >
</cf_dsp_select>
for the above custom tag i will get dropdown options with check box , for this i am not getting this logic to implement javascript , please help me
Thanks
Copy link to clipboard
Copied
hi here is what the custom tag is geenrating
<form>
<input type="checkbox" value="005" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">one
<input type="checkbox" value="006" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Two
<input type="checkbox" value="007" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Three
<input type="checkbox" value="008" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Four
<input type="checkbox" value="009" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Five
<input type="checkbox" value="010" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Six
<input type="checkbox" value="011" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Seven
<input type="checkbox" value="012" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Eight
<input type="checkbox" value="013" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Nine
<input type="checkbox" value="014" style="margin: 0px 8px 0px 2px;" name="div_no" id="div_no">Ten
</form>
from this how we do that javascript to work .
Thanks