function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShaTShaT 

Removing MultiPicklist Values

Hi ,

 

I have two panels  which Contains MultiPiclist and Dependent picklist and Input Fields. I want to clear all fileds if the user goes to another panel.

I m calling a javascript function to clear all fields.

Input fields and picklist becomes null  but problem is with Multiselect . Its Selected value are not null.It displayes previous selected values in selected area.

 

How can i empty Multipicklist

 

Thanks&Regards

Shailu

shruthishruthi

Can you please post the code?

 

Multi-select is a list of values separated by a semi-colon. Hope this might help you get some logic for the code.

Pradeep_NavatarPradeep_Navatar

Find below a sample code to deselect the selected multiselect values using javascript:

 

                   var selectList = document.getElementById('{!$Component.PageId:FormId:pageBlockId:MulSelectedList}');

                   var selectOptions = selectList.getElementsByTagName('option');

                                for(var i = 1; i < selectOptions.length; i++)

                                {

                                                var opt = selectOptions[i];

                                                if(opt.selected)

                                                {

                                                                selectList.options[i].selected = false;

                                                }

                                }

 

Hope this helps.