You need to sign in to do that
Don't have an account?
Cris9931
multiselect picklist
I created a multiselect picklist in jQuery and it looks like this:now the code for this is:
<!DOCTYPE html> <html lang="en-us"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> </head> <body> <table> <tr> <td><select id="picklist1" multiple></select></td><td></td> <td><select id="picklist2" multiple></select></td><td></td> <td><select id="picklist3" multiple></select></td><td></td> </tr> </table> <script> (function($) { $.fn.multipicklist = function( options ) { var source = $(this[0]); var target = $(this[1]); if (options && options.length > 0) { $.each(options, function (i, item) { source.append($('<option>', { value: i, text: item })); }); } var td = source.parent().next(); td.append($('<p><a id="addTo' + target.attr('id') + '" href="#">></a></p>')); td.append($('<p><a id="subtractFrom' + target.attr('id') + '" href="#"><</a></p>')); $("#addTo" + target.attr('id')).click(function (e) { target.append(source.find(":selected")); source.find(":selected").remove(); }); $("#subtractFrom" + target.attr('id')).click(function (e) { source.append(target.find(":selected")); target.find(":selected").remove(); }); }; }(jQuery)); $("#picklist1, #picklist2").multipicklist(["option1","option2","option3","option4"]); $("#picklist2, #picklist3").multipicklist(); </script> </body> </html>
And for this requirement I need the values from my picklist field instead of "option1","option2","option3","option4". Question is: How can get the values from my picklist field? I created a variable like this:
public Visit_Report__c record {get; set;}
then somewhere in my code, in my VF page i need to add this, I think:
!record.Innovation_presented_to_customer__cAny ideas how to implement this?
public List<String> getPickListValues(){
List<String> pickListValues= new List<String>();
Schema.DescribeFieldResult fieldResult = ObjectApiName.FieldApiName.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry pickListVal : ple){
pickListValues.add(pickListVal.getLabel());
}
return pickListValuesList;
}
Thanks
Ramesh