0

I have a Picklist(multi seletct) and save Button in a page. when i select some values in that and then click on save button, it is be displaying in a table(selected values with edit link), i have used rendered for Save Button and for Edit link.And then this page has been embeded in a pagelayout.when i select some values in a picklist and after save it is diaplaying in table.Before leaving the record detail page if i click on edit link it is rendered to the picklist and highlighting the previously selected values. But when i refresh the record detail page and make a click on edit link...... it is not highlighting the previously selected values in picklist.

<script type="text/javascript">  
function beforeTextSave() {
    var xx='{!countrylist}'.defaultvalue;
    //alert(xx);

    var sel= document.getElementById('xx').selected.value;
    //alert(sel);
    console.log(sel);

    if(xx!=null){
        for(var x in xx){
            for (var i=0; i<sel.options.length; i++){
                if ( document.sel.options[i].value == x ){
                    document.sel.options[i].selected = true;
                    break;
                }
            }
            document.getElementById('{!$Component.sss}').value() = '';
        }
    }
}
</script>

<apex:selectList value="{!Competitor}" 
                 multiselect="true" 
                 onchange="javascript:beforeTextSave(this)" 
                 size="5" 
                 style="width:200px" 
                 id="sss">
    <apex:selectOptions value="{!Comp}"/>
    <apex:actionSupport event="onclick" action="{!updateProduct}" rerender="act" />
</apex:selectList>

In class

if((cnid1.Competitor__c!=null)&&(cnid1!=null)){
    Countrylist=new List<String>();
    Countrylist=cnid1.Competitor__c.split(';');
}

why iam unable to see the previously selected values highlighted after whole url refresh.

can any one send me sample code to achieve this where i have missed.

  • Can you provide us with some code? – Artur Kępczyński Feb 4 '14 at 9:01
  • in cnid1 i have a query Competitor__c from custom object – user5494 Feb 4 '14 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.