Wednesday, October 3, 2012

Multi Select Checkboxes – Custom Controls-Part1 in CRM 2011

Multi select check boxes control is a very essential control in web forms. Some times client needs exactly the same control in CRM forms as well. When there a requirement is to develop a dynamic multi select checkboxes control its really difficult for the developer to implement the feature in CRM. CRM developers will get the little relief with this post.
An Option Set control and a Multi line textbox are used to create the Multi Select Checkboxes control. Labels of the checkboxes can be stored in the optionset control as items. Selected values will be saved in the multi line textbox seperated by semi colons.
Control looks like this in the CRM form after implementing it.



Follow the steps below to work with Multi Select Checkbox control.
[1] Create a OptionSet control and add items to the option set. Items are the checkbox captions in the control.
[2] Create a Multi line textbox. This will hold all the selected item values.
[3] Add the MultiSelectCheckboxLibrary javascript library to the resources and add it to the form.
Download Multi Select Checkboxes Library Here
[4] Add “OptionSetToMultiSelect.Functions.ToMultiSelect” with relevant parameters to OnLoad event of the form

ToMultiSelect: function (var_sc_optionset, var_sc_optionsetvalue, required, column)

var_sc_optionset – Name of the option set field
var_sc_optionsetvalue – Name of the multiline textbox
required – Whether the new field(Multi Select Checkboxes control) is required or not
columns – Number of columns to be appeared in the control for checkboxes
E.g. 'new_hobby','new_hobbyvalues',true,1
[5] Add “OptionSetToMultiSelect.Functions.CheckAllMultiCheckboxWithLayersRequiredFields” to OnSave event of the form

// Function to be invoked page OnSave
CheckAllMultiCheckboxWithLayersRequiredFields: function ()

No comments:

Post a Comment