Merge pull request #17981 from eileenmcnaughton/merge_form
[civicrm-core.git] / templates / CRM / Custom / Form / ChangeFieldType.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 4 | |
1188c7a8
TO
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
6a488035
TO
8 +--------------------------------------------------------------------+
9*}
10<div class="crm-block crm-form-block crm-custom-field-form-block">
11<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
34d6cec4 12 <div class='status'>{icon icon="fa-info-circle"}{/icon}
6a488035
TO
13 &nbsp;{ts}Warning: This functionality is currently in beta stage. Consider backing up your database before using it. Click "Cancel" to return to the "edit custom field" form without making changes.{/ts}
14 </div>
15 <table class="form-layout">
16 <tr class="crm-custom-src-field-form-block-label">
17 <td class="label">{$form.src_html_type.label}</td>
18 <td class="html-adjust">{$form.src_html_type.html}</td>
19 </tr>
20 <tr class="crm-custom-dst-field-form-block-label">
21 <td class="label">{$form.dst_html_type.label}</td>
22 <td class="html-adjust">{$form.dst_html_type.html}</td>
23 </tr>
24 </table>
25<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
26</div>
27{literal}
28<script type="text/Javascript">
6a488035 29 function checkCustomDataField( ) {
8838f818 30 var srcHtmlType = {/literal}{$srcHtmlType|@json_encode}{literal};
ae8f569f 31 var singleValOps = ['Text', 'Select', 'Radio', 'Autocomplete-Select'];
6cc845ad 32 var multiValOps = ['CheckBox', 'Multi-Select'];
6a488035
TO
33 var dstHtmlType = cj('#dst_html_type').val( );
34 if ( !dstHtmlType ) {
35 return true;
36 }
37
38 if ( ( cj.inArray(srcHtmlType, multiValOps) > -1 ) &&
39 ( cj.inArray(dstHtmlType, singleValOps) > -1 ) ) {
40 return confirm( "{/literal}{ts escape='js'}Changing a 'multi option' html type to a 'single option' html type, might results in a data loss. Please consider to take db backup before change the html type. Click 'Ok' to continue.{/ts}{literal}" );
41 }
42 return true;
43 }
44</script>
45{/literal}
46