X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.searchForm.js;h=42a371dcecf42d18e90d97dae3038d2992d098b7;hb=79c79f430835ea19d2befdd9fd307fd30e445418;hp=3de76afb892c801518dac1747aa08c3a92bab25a;hpb=2078a04eb10e9a0d655ea6dfa6c8d02615f0aefe;p=civicrm-core.git diff --git a/js/crm.searchForm.js b/js/crm.searchForm.js index 3de76afb89..42a371dcec 100644 --- a/js/crm.searchForm.js +++ b/js/crm.searchForm.js @@ -63,13 +63,13 @@ params.name = $('input.select-row').map(function() {return $(this).attr('id');}).get().join('-'); } } - $.getJSON(url, params, function(data) { + $.post(url, params, function(data) { if (data && data.getCount !== undefined) { selected = data.getCount; displayCount(); enableTaskMenu(); } - }); + }, 'json'); } /** @@ -100,6 +100,10 @@ $(function() { initForm(); + + // Focus first search field + $('.crm-form-text:input:visible:first', 'form.crm-search-form').focus(); + // Handle user interactions with search results $('#crm-container') // When toggling between "all records" and "selected records only" @@ -128,14 +132,50 @@ } }) // When selecting a task - .on('change', 'select#task', function() { + .on('change', 'select#task', function(e) { var $form = $(this).closest('form'), - $go = $('input.crm-search-go-button', $form); - if (1) { + $go = $('input.crm-search-go-button', $form); + var $selectedOption = $(this).find(':selected'); + if (!$selectedOption.val()) { + // do not blank refresh the empty option. + return; + } + if ($selectedOption.data('is_confirm')) { + var confirmed = false; + var refresh_fields = $selectedOption.data('confirm_refresh_fields'); + var $message = '