Lock, Disable Selection
In the event that you need to lock certain selections so that they can’t be removed, you can now pass in “locked” => true when calling set_init_selection(). Note that lock a selection is only possible when multiple selection is enabled.
To disable a selection from selected in the dropdown, add “disabled”=>true to the data source.
In the following example, the selection “Microsoft” is disabled.
$data = array(array('id'=>1, 'text'=>'Apple'),
array('id'=>2, 'text'=>'Google'),
array('id'=>3, 'text'=>'Microsoft', 'disabled'=>true),
array('id'=>4, 'text'=>'Facebook'),
array('id'=>5, 'text'=>'Twitter'));
$pac = new C_PhpAutocomplete('lock_selection_INPUT', $data);
$pac->enable_multiple(true); // hidden input only
$pac->set_init_selection(array(
array("id"=>"1", "text"=>"Apple"),
array("id"=>"5", "text"=>"Twitter", "locked"=>true)));
$pac->display();
?>
<input id="lock_selection_INPUT" type="hidden" value="" />