$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this);
$this->_tableID = $this->_entityId;
$this->_copyValueId = CRM_Utils_Request::retrieve('copyValueId', 'Positive', $this);
+ $backUrl = CRM_Core_Session::singleton()->readUserContext();
+ $this->assign('backUrl', $backUrl);
+ if (!empty($_POST['hidden_custom'])) {
+ $this->assign('postedInfo', TRUE);
+ }
}
return;
}
+--------------------------------------------------------------------+
*}
{* this template is used for building tabbed custom data *}
-{if $cdType }
+{if $cdType || $postedInfo}
{include file="CRM/Custom/Form/CustomData.tpl"}
{if $multiRecordDisplay eq 'single'}
<div class="html-adjust">{$form.buttons.html}</div>
<script type='text/javascript'>
cj(function($) {
$('#custom-record-dialog .crm-container-snippet #CustomData').validate(CRM.validate.params);
+ var formOptions = {
+ success: checkResponse // post-submit callback
+ };
+
+ //binding the callback to snippet profile form
+ $('.crm-container-snippet #CustomData').ajaxForm(formOptions);
});
+
+ // 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.href = '{/literal}{$backUrl}{literal}';
+ }
+ }
</script>
{/literal}
{/if}