Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
MultiSelect value
System
Hi,
I have a dropdown i am getting selected data with the below code.
var index = IWDatacapture.getItem("/Site").getValue();
var option = IWDatacapture.getItem("/Site").getOptions();
var value = option[index].value;
Now we made dropdown as multiselect i mean iused the option multiple="t". Could any one suggest me to get the selected values. When i use above code it is giving error.
Thanx in advance
Find more posts tagged with
Comments
Michael
When you use getValue on a multi-select list it returns an array of indexes. You could then iterate through this array and get the values in a similar way to how you are getting the values presently. What you do with those values is then up to you -- store them in an array, build them into a sperated list, etc.
hth
Cheers
Michael
Migrateduser
Thanx for your reply it helps.Does this multi selection has any other events than onItemChage?
Thanx in advance
Michael
Not that I know of sorry.
Migrateduser
try something u'll like it
var index = IWDatacapture.getItem("/Site").getValue();
var option = IWDatacapture.getItem("/Site").getOptions();
for(var i=0;index.length;i++){
alert('value selected is:'+option[index
].value);
}
Migrateduser
line is actually alert('value selected is:'+option[index
.value);
in the loop
hope it helps
Migrateduser
Thanx for your info.
I populated list with perl scrit and i have all check box next to it. When i click on All check box i need select focus on all list . Is it possible through FormAPI hope there should be some way
Thanx in advance
Michael
Yep, should be possible.
Have an onItemChange event on your checkbox. Check the value.
If they have selected the All box then do a setValue on your multi-select list. You will need to pass in an array of numbers. So if you have three items in your multiselect list then your array should have 0,1,2 in it.
If they have unselected the select all checkbox you may wish to clear their selection -- passing in an empty array to setValue should do the trick.
You will probably need to do a redraw after the setValue for the change to be visible.
hth
Cheers
Michael