From: vivekarora Date: Mon, 19 Aug 2013 12:16:31 +0000 (+0530) Subject: CRM-13169 - Corrected file upload issue X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5e35a290664955e1bef7ebf953e86a5a3e27d9de;p=civicrm-core.git CRM-13169 - Corrected file upload issue ---------------------------------------- * CRM-13169: Files attached via profile popups don't work http://issues.civicrm.org/jira/browse/CRM-13169 --- diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl index d8affcab48..c3b46498a3 100644 --- a/templates/CRM/Profile/Form/Dynamic.tpl +++ b/templates/CRM/Profile/Form/Dynamic.tpl @@ -34,40 +34,21 @@ cj(function($) { $('#profile-dialog .crm-container-snippet #Edit').validate(CRM.validate.params); var formOptions = { - beforeSubmit: proccessMultiRecordForm //pre-submit callback + success: checkResponse // post-submit callback }; //binding the callback to snippet profile form $('.crm-container-snippet #Edit').ajaxForm(formOptions); }); -// pre-submit callback -function proccessMultiRecordForm(formData, jqForm, options) { - var queryString = cj.param(formData); - queryString = queryString + '{/literal}{$urlParams}{literal}' + '&snippet=1'; - - if (cj('#profile-dialog')) { - var postUrl = {/literal}"{crmURL p='civicrm/profile/edit' h=0 }"{literal}; - var response = cj.ajax({ - type: "POST", - url: postUrl, - async: false, - data: queryString, - dataType: "json", - - }).responseText; - - //if there is any form error show the dialog - //else redirect to post url - if (!cj(response).find('.crm-error').html()) { - window.location = '{/literal}{$postUrl}{literal}'; - } - - // here we could return false to prevent the form from being submitted; - // returning anything other than false will allow the form submit to continue - return false; +// post-submit callback +function checkResponse(responseText, statusText, xhr, $form) { + //if there is any form error show the dialog + //else redirect to post url + if (!cj(responseText).find('.crm-error').html()) { + window.location = '{/literal}{$postUrl}{literal}'; } -} +} {/literal} {include file="CRM/Form/validate.tpl"}