- var openAddNewWindow = function() {
- var url = CRM.url('civicrm/admin/custom/group/field/add', {
- reset: 1,
- action: 'add',
- gid: section.custom_group_id
- });
- window.open(url, '_blank');
- };
-
- if (paletteView.hideAddFieldAlert) {
- openAddNewWindow();
- } else {
- CRM.confirm(function() {
- paletteView.hideAddFieldAlert = true;
- openAddNewWindow();
- }, {
- title: ts('Add Field'),
- message: ts('A new window or tab will open. Use the new window to add your field, and then return to this window and click "Refresh."')
+ var url = CRM.url('civicrm/admin/custom/group/field/add', {
+ reset: 1,
+ action: 'add',
+ gid: section.custom_group_id
+ });
+ CRM.loadForm(url, {
+ resetButton: 'next_new',
+ onSuccess: function(data, settings) {
+ paletteView.doRefresh('custom_' + data.customField.id);
+ if (data.buttonName != 'next_new') {
+ $(settings.target).dialog('close');