if ($form->_searchOptions['contactType']) {
// add checkboxes for contact type
- $contact_type = array();
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
if ($contactTypes) {
$form->add('select', 'contact_type', ts('Contact Type(s)'), $contactTypes, FALSE,
- array('id' => 'contact_type', 'multiple' => 'multiple', 'title' => ts('- select -'))
+ array('id' => 'contact_type', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;')
);
}
}
$groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($form->_group, NULL, ' ', TRUE);
$form->add('select', 'group', ts('Groups'), $groupHierarchy, FALSE,
- array('id' => 'group', 'multiple' => 'multiple', 'title' => ts('- select -'))
+ array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2')
);
$groupOptions = CRM_Core_BAO_OptionValue::getOptionValuesAssocArrayFromName('group_type');
$form->add('select', 'group_type', ts('Group Types'), $groupOptions, FALSE,
- array('id' => 'group_type', 'multiple' => 'multiple', 'title' => ts('- select -'))
+ array('id' => 'group_type', 'multiple' => 'multiple', 'class' => 'crm-select2')
);
$form->add('hidden','group_search_selected','group');
}
if ($contactTags) {
$form->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
- array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -'))
+ array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;')
);
}
array(
'id' => 'privacy_options',
'multiple' => 'multiple',
- 'title' => ts('- select -'),
+ 'class' => 'crm-select2',
)
);
$form->addGroup($commPreff, 'preferred_communication_method', ts('Preferred Communication Method'));
//CRM-6138 Preferred Language
- $form->add('select', 'preferred_language', ts('Preferred Language'), array('' => ts('- any -')) + CRM_Contact_BAO_Contact::buildOptions('preferred_language'));
+ $form->add('select', 'preferred_language', ts('Preferred Language'), array('' => ts('- any -')) + CRM_Contact_BAO_Contact::buildOptions('preferred_language'), FALSE, array('class' => 'crm-select2'));
// Phone search
$form->addElement('text', 'phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
}
else {
//if not setdefault any country
- $selectElements = array('' => ts('- any -')) + CRM_Core_PseudoConstant::$select();
+ $selectElements = CRM_Core_PseudoConstant::$select();
}
- $element = $form->addElement('select', $name, $title, $selectElements);
+ $element = $form->add('select', $name, $title, $selectElements, FALSE, array('class' => 'crm-select2'));
}
elseif ($select == 'country') {
$selectElements = array('' => ts('- any -')) + CRM_Core_PseudoConstant::$select();
- $element = $form->addElement('select', $name, $title, $selectElements);
+ $element = $form->add('select', $name, $title, $selectElements, FALSE, array('class' => 'crm-select2'));
}
elseif ($select == 'county') {
if ( array_key_exists('state_province', $formValues) && !CRM_Utils_System::isNull($formValues['state_province'])) {
else {
$selectElements = array('' => ts('- any -'));
}
- $element = $form->addElement('select', $name, $title, $selectElements);
+ $element = $form->add('select', $name, $title, $selectElements, FALSE, array('class' => 'crm-select2'));
}
else {
$selectElements = array('' => ts('- any -')) + CRM_Core_PseudoConstant::$select();
- $element = $form->addElement('select', $name, $title, $selectElements);
+ $element = $form->add('select', $name, $title, $selectElements, FALSE, array('class' => 'crm-select2'));
}
if ($multiSelect) {
$element->setMultiple(TRUE);
$form->addRule('prox_distance', ts('Please enter positive number as a distance'), 'numeric');
$worldRegions = array('' => ts('- any region -')) + CRM_Core_PseudoConstant::worldRegion();
- $form->addElement('select', 'world_region', ts('World Region'), $worldRegions);
+ $form->add('select', 'world_region', ts('World Region'), $worldRegions, FALSE, array('class' => 'crm-select2'));
// checkboxes for location type
$location_type = array();
$allRelationshipType = array();
$allRelationshipType = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE);
- $form->addElement('select', 'relation_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $allRelationshipType);
+ $form->add('select', 'relation_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $allRelationshipType, FALSE, array('class' => 'crm-select2'));
$form->addElement('text', 'relation_target_name', ts('Target Contact'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
// relation status
$relStatusOption = array(ts('Active '), ts('Inactive '), ts('All'));
//add the target group
if ($form->_group) {
$form->add('select', 'relation_target_group', ts('Target Contact(s) in Group'), $form->_group, FALSE,
- array('id' => 'relation_target_group', 'multiple' => 'multiple', 'title' => ts('- select -'))
+ array('id' => 'relation_target_group', 'multiple' => 'multiple', 'class' => 'crm-select2')
);
}
CRM_Core_Form_Date::buildDateRange($form, 'relation_start_date', 1, '_low', '_high', ts('From:'), FALSE, FALSE);
{if $form.contact_type}
<td><label>{ts}Contact Type(s){/ts}</label><br />
{$form.contact_type.html}
- {literal}
- <script type="text/javascript">
-
- cj("select#contact_type").crmasmSelect({
- respectParents: true
- });
-
- </script>
- {/literal}
</td>
{else}
<td> </td>
<td>
<div id='groupselect'><label>{ts}Group(s){/ts}<span class="crm-clear-link">(<a id='searchbygrouptype'>{ts}search by group type{/ts}</a>)</span></label>
{$form.group.html}
- {literal}
- <script type="text/javascript">
- cj("select#group").crmasmSelect({
- respectParents: true
- });
-
-
- </script>
- {/literal}
</div>
<div id='grouptypeselect'>
<label>{ts}Group Type(s){/ts}<span class="crm-clear-link"> ( <a id='searchbygroup'>{ts}search by group{/ts}</a>)</span></label>
{$form.group_type.html}
{literal}
<script type="text/javascript">
- cj("select#group_type").crmasmSelect({
- respectParents: true
- });
-
- function showGroupSearch(){
+ cj(function(){
+ function showGroupSearch(){
cj('#grouptypeselect').hide();
cj('#groupselect').show();
- cj('#group_type').val('') ;
- cj('#crmasmList2 li').remove();
- cj('#crmasmSelect2').children().removeClass('asmOptionDisabled').prop('disabled', false);
- }
- function showGroupTypeSearch(){
+ cj('#group_type').select2('val', '');
+ }
+ function showGroupTypeSearch(){
cj('#groupselect').hide();
cj('#grouptypeselect').show();
- cj('#group').val('') ;
- cj('#crmasmList1 li').remove();
- cj('#crmasmSelect1').children().removeClass('asmOptionDisabled').prop('disabled', false);
- }
-
- cj(function(){
+ cj('#group').select2('val', '');
+ }
cj('#searchbygrouptype').click(function() {
showGroupTypeSearch();
});
{if $form.contact_tags}
<td><label>{ts}Select Tag(s){/ts}</label>
{$form.contact_tags.html}
- {literal}
- <script type="text/javascript">
-
- cj("select#contact_tags").crmasmSelect({
- respectParents: true
- });
-
- </script>
- {/literal}
</td>
{else}
<td> </td>
</table>
{literal}
<script type="text/javascript">
- cj("select#privacy_options").crmasmSelect();
cj("select#privacy_options").change(function() {
- var items = cj(this).siblings('ul.crmasmList').find('li').length;
- if (items > 1) {
+ if (cj(this).val() && cj(this).val().length > 1) {
cj('#privacy-operator-wrapper').show();
} else {
cj('#privacy-operator-wrapper').hide();