I have a simple quickform --

    $this->add('text','trial_number','Trial Number',TRUE);
    $this->add('date','Trial_Date',ts('Trial Date'),CRM_Core_SelectValues::date(NULL, 'Y M d',15,1) );
    $this->addEntityRef('judge',ts('Assigned Judge'));
    $this->add('advmultiselect','started_components','Started Components',$this->getOptions("regComponents"),FALSE);
    $this->add('advmultiselect','advanced_components','Advanced Components',$this->getOptions("regComponents"),FALSE);
    $this->add('advmultiselect','excellent_components','Excellent Components',$this->getOptions("regComponents"),FALSE);
    $this->add('checkbox','elite_offered','Elite Offered',FALSE);
    $this->add('advmultiselect','games_components','Games Components',$this->getOptions("gameComponents"),FALSE);  

However, the advmultiselect fields I would like to use select2 for multiple selections of the options. I have searched, and searched, yet cannot find any examples as to the format of the select2 add. The options are straight forward - all in a function called getOptions(). The advmultiselect works, but well, that's just ugly.

What is the format of the add('select2'.... and what attributes can I set?

Thanks Norm

1 Answer 1


It should work using the following format

$this->add('select', [YOUR CODE HERE] array('multiple' => TRUE, 'class' => 'crm-select2'));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.