// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
- CRM_Custom_Form_CustomData::preProcess($this);
+ $this->set('type', 'Event');
+ $this->set('entityId', $this->_surveyId);
+ CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
+ CRM_Custom_Form_CustomData::setDefaultValues($this);
}
$session = CRM_Core_Session::singleton();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
+ $customFields = CRM_Core_BAO_CustomField::getFields('Survey');
+ $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
+ $this->_surveyId,
+ 'Survey'
+ );
+
$surveyId = CRM_Campaign_BAO_Survey::create($params);
// also update the ProfileModule tables
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
+ // when custom data is included in this page
+ if (!empty($_POST['hidden_custom'])) {
+ $this->set('type', 'Event');
+ $this->set('entityId', $this->_surveyId);
+ CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
+ CRM_Custom_Form_CustomData::buildQuickForm($this);
+ CRM_Custom_Form_CustomData::setDefaultValues($this);
+ }
+
// CRM-11480, CRM-11682
// Preload libraries required by the "Questions" tab
CRM_UF_Page_ProfileEditor::registerProfileScripts();
</td>
</tr>
</table>
+ <div id="customData"></div>
+ {*include custom data js file*}
+ {include file="CRM/common/customData.tpl"}
+ {literal}
+ <script type="text/javascript">
+ CRM.$(function($) {
+ {/literal}
+ CRM.buildCustomData( 'Survey' );
+ {literal}
+ });
+ </script>
+ {/literal}
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
</td>
</tr>
</table>
+ <div id="customData"></div>
+ {*include custom data js file*}
+ {include file="CRM/common/customData.tpl"}
+ {literal}
+ <script type="text/javascript">
+ CRM.$(function($) {
+ {/literal}
+ CRM.buildCustomData( 'Survey' );
+ {literal}
+ });
+ </script>
+ {/literal}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>