Merge pull request #3146 from mepps/fix-prepopulate-send-email
[civicrm-core.git] / js / view / crm.profile-selector.js
index f36c8f2313bf9a06179842dc943f4c60d7d34e45..1b76bbcf6d7ae207c979a64a234073c929cabe3d 100644 (file)
@@ -57,6 +57,7 @@
       this.selectRegion.show(view);
       this.setUfGroupId(this.options.ufGroupId, {silent: true});
       this.toggleButtons();
+      this.$('.crm-profile-selector-select select').css('width', '25em').crmSelect2();
     },
     onChangeUfGroupId: function(event) {
       this.options.ufGroupId = $(event.target).val();
@@ -73,9 +74,7 @@
     setUfGroupId: function(value, options) {
       this.options.ufGroupId = value;
       this.$('.crm-profile-selector-select select').val(value);
-      if (!options || !options.silent) {
-        this.$('.crm-profile-selector-select select').change();
-      }
+      this.$('.crm-profile-selector-select select').select2('val', value, (!options || !options.silent));
     },
     getUfGroupId: function() {
       return this.options.ufGroupId;