[TEST] All Content Feed
Confluence Syndication Feed
https://wiki.vertuna.com
Change field label with Field Definition rule and JavaScript
Alex Medved
tag:wiki.vertuna.com,2009:page-42008598-11
2024-03-22T07:30:40Z
2019-04-12T03:04:57Z
<div class="feed"> <p>
Page
<b>edited</b> by
<a href=" https://wiki.vertuna.com/display/~sash
">Alex Medved</a>
</p>
<div style="border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 10px;">
<p>Online demo to demonstrate how to use ConfiForms Field Definition to change the field's label</p><p>Via dialog</p>
<style type="text/css">
.confiFormsFormBorder {
border: 1px solid #ccc; border-radius: 3px;margin: 10px 0 20px 0;
/*max-width: 720px;*/
/*min-width: 720px;*/
}
.confiFormsFormContent {
padding: 20px;
}
.confiFormsFormTitle {
padding: 10px;
}
.confiFormsFormFooter {
background-color:#f0f0f0;
padding-top: 10px;
padding-bottom: 10px;
padding-right: 20px;
padding-left: 20px;
}
</style>
<div id="i_confiform_registration_panel_fb69de855b5d303ad024a8b0fd7aca29" style="display: none;mso-hide:all;" class="cf_myform">
<style type="text/css">
.large-field {
max-width: 380px !important;
}
.aui-dropdown {
z-index: 9999;
}
.aui-confiforms .aui-dropdown li a {
cursor: pointer;
height: 25px;
min-height: 25px;
display: block;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius:0;
color: black;
background-color: white;
}
.aui-confiforms .aui-dropdown li a:hover {
border: 0;
background-color: #c0c0c0 !important;
}
.ui-state-hover {
border: 0 !important;
background-color: #c0c0c0 !important;
}
.cf-calendar {
display: inline-block;
width: 26px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar.png') no-repeat 0 center
}
.cf-calendar-time {
display: inline-block;
width: 26px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar-time.png') no-repeat 0 center
}
.cf-calendar-clock {
display: inline-block;
width: 24px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar-clock.png') no-repeat 0 center
}
.aui-confiforms div.select {
padding: 0 !important;
}
.aui-confiforms div.text {
padding: 0 !important;
}
.select2-container-multi {
padding: 0 !important;
}
.cf_readonly {
background-color: #d4d4d4 !important;
}
.cf_validation_error {
border-color: #d04437 !important;
}
.cf_field_validation_error {
color: #d04437 !important;
}
.aui-select2-container.select2-allowclear .select2-choice .select2-search-choice-close {
display: block;
opacity: 0.7;
top: 10px;
height: 0;
}
.aui-select2-container.select2-allowclear .select2-choice .select2-search-choice-close:hover {
opacity: 1;
}
.cf_textarea {
max-width: 380px !important;
width: 380px;
min-width: 250px;
}
.cf_select2 {
min-width:250px !important;
}
.cf_dynamicmutlilabel {
min-width:250px;
width: 250px;
}
.cf_dynamicselect {
min-width:250px;
max-width:250px;
width:250px;
}
.cf_dbdynamicselect {
min-width:250px;
max-width:250px;
width:250px;
}
</style>
<form action="https://wiki.vertuna.com/ajax/confiforms/success.action" method="post" class="aui aui-confiforms cf-fb69de855b5d303ad024a8b0fd7aca29" id="i_confiform_registration_form" target="_self" enctype="multipart/form-data"
style="margin-top: 0; display:none;"
autocomplete="off">
<input id="pageId" name="pageId" type="hidden" value="42008598"/>
<input id="storagePageId" name="storagePageId" type="hidden" value="42008598"/>
<input id="confiform_entry_id" name="entryId" type="hidden" value=""/>
<input name="copiedFromId" type="hidden" value=""/>
<input id="confiform_form_name" name="registrationFormName" type="hidden" value="myform"/>
<input id="confiform_params_hash" name="paramsHash" type="hidden" value="9ca441194dd87dbf4e9275273e092ec6"/>
<input id="confiform_params_macroId" name="macro_id_hash" type="hidden" value="a1f5ea76-c445-4721-a63f-6266ca08a6bb"/>
<input id="confiform_printEditable" name="printEditable" type="hidden" value="false"/>
<input id="confiform_skipIfParamIsEmpty" name="_skipIfParamIsEmpty" type="hidden" value="false"/>
<div class="table-wrap">
<table id="i_registrationFormTable_fb69de855b5d303ad024a8b0fd7aca29" style="width:100%" class="aui" cellpadding="7" cellspacing="7">
<tbody>
<tr class="i_holdingrow_change" style="border:0">
<td style="width: 31%;border:0;vertical-align: top;">
<strong><label style="font-weight:bold" id="i_labelfor_change" for="i_change">Change </label></strong>
</td>
<td style="width: 67%;border:0;">
<span id="i_holdingrow_change"><input cf-field="change" class="radio cf_single_chck " type="checkbox" name="change" id="i_change"/></span>
</td>
</tr>
<tr class="i_holdingrow_fld" style="border:0">
<td style="width: 31%;border:0;vertical-align: top;">
<strong><label style="font-weight:bold" id="i_labelfor_fld" for="i_fld">Original label text </label></strong>
</td>
<td style="width: 67%;border:0;">
<span id="i_holdingrow_fld"><input cf-field="fld" type="text" id="i_fld" name="fld" class="text large-field cf_text " title="Original label text"/></span>
</td>
</tr>
</tbody>
</table>
</div>
<button id="confiform_form_submit" class="save-cf-btn1" name="registrationFormSubmit" style="display: none">Save</button>
</form>
</div>
<button class="aui-button aui-button-primary cf_myform" type="button" style="margin-left: 0;" title="Register" id="i_confiform_add_new_button_fb69de855b5d303ad024a8b0fd7aca29">Register</button>
<p>Embedded form
<style type="text/css">
.confiFormsFormBorder {
border: 1px solid #ccc; border-radius: 3px;margin: 10px 0 20px 0;
/*max-width: 720px;*/
/*min-width: 720px;*/
}
.confiFormsFormContent {
padding: 20px;
}
.confiFormsFormTitle {
padding: 10px;
}
.confiFormsFormFooter {
background-color:#f0f0f0;
padding-top: 10px;
padding-bottom: 10px;
padding-right: 20px;
padding-left: 20px;
}
</style>
<div id="i_confiform_registration_panel_ed7ac728ba71b5d617ab98348a33bee9" class="confiFormsFormBorder cf_myform" style=" display:none;">
<div class="confiFormsFormContent">
<div class="confiFormsFormTitle"><h2 id="ChangefieldlabelwithFieldDefinitionruleandJavaScriptClickonchangefieldtoseethelabelchange">Click on change field to see the label change</h2></div>
<style type="text/css">
.large-field {
max-width: 380px !important;
}
.aui-dropdown {
z-index: 9999;
}
.aui-confiforms .aui-dropdown li a {
cursor: pointer;
height: 25px;
min-height: 25px;
display: block;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius:0;
color: black;
background-color: white;
}
.aui-confiforms .aui-dropdown li a:hover {
border: 0;
background-color: #c0c0c0 !important;
}
.ui-state-hover {
border: 0 !important;
background-color: #c0c0c0 !important;
}
.cf-calendar {
display: inline-block;
width: 26px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar.png') no-repeat 0 center
}
.cf-calendar-time {
display: inline-block;
width: 26px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar-time.png') no-repeat 0 center
}
.cf-calendar-clock {
display: inline-block;
width: 24px;
height: 20px;
background: transparent url('/s/-z4gfsa/9012/m4ydwl/_/download/resources/com.vertuna.confluence.plugins.confiforms:confiformResources/confi-calendar-clock.png') no-repeat 0 center
}
.aui-confiforms div.select {
padding: 0 !important;
}
.aui-confiforms div.text {
padding: 0 !important;
}
.select2-container-multi {
padding: 0 !important;
}
.cf_readonly {
background-color: #d4d4d4 !important;
}
.cf_validation_error {
border-color: #d04437 !important;
}
.cf_field_validation_error {
color: #d04437 !important;
}
.aui-select2-container.select2-allowclear .select2-choice .select2-search-choice-close {
display: block;
opacity: 0.7;
top: 10px;
height: 0;
}
.aui-select2-container.select2-allowclear .select2-choice .select2-search-choice-close:hover {
opacity: 1;
}
.cf_textarea {
max-width: 380px !important;
width: 380px;
min-width: 250px;
}
.cf_select2 {
min-width:250px !important;
}
.cf_dynamicmutlilabel {
min-width:250px;
width: 250px;
}
.cf_dynamicselect {
min-width:250px;
max-width:250px;
width:250px;
}
.cf_dbdynamicselect {
min-width:250px;
max-width:250px;
width:250px;
}
</style>
<form action="https://wiki.vertuna.com/ajax/confiforms/success.action" method="post" class="aui aui-confiforms cf-ed7ac728ba71b5d617ab98348a33bee9" id="i_confiform_registration_form" target="_self" enctype="multipart/form-data"
style="margin-top: 0; display:none;"
autocomplete="off">
<input id="pageId" name="pageId" type="hidden" value="42008598"/>
<input id="storagePageId" name="storagePageId" type="hidden" value="42008598"/>
<input id="confiform_entry_id" name="entryId" type="hidden" value=""/>
<input name="copiedFromId" type="hidden" value=""/>
<input id="confiform_form_name" name="registrationFormName" type="hidden" value="myform"/>
<input id="confiform_params_hash" name="paramsHash" type="hidden" value="6d1dca5a6f76dd286cc78fc32b0c9088"/>
<input id="confiform_params_macroId" name="macro_id_hash" type="hidden" value="8c63040d-a485-498f-9313-2d6c6c879b89"/>
<input id="confiform_printEditable" name="printEditable" type="hidden" value="false"/>
<input id="confiform_skipIfParamIsEmpty" name="_skipIfParamIsEmpty" type="hidden" value="false"/>
<div class="table-wrap">
<table id="i_registrationFormTable_ed7ac728ba71b5d617ab98348a33bee9" style="width:100%" class="aui" cellpadding="7" cellspacing="7">
<tbody>
<tr class="i_holdingrow_change" style="border:0">
<td style="width: 31%;border:0;vertical-align: top;">
<strong><label style="font-weight:bold" id="i_labelfor_change" for="i_change">Change </label></strong>
</td>
<td style="width: 67%;border:0;">
<span id="i_holdingrow_change"><input cf-field="change" class="radio cf_single_chck " type="checkbox" name="change" id="i_change"/></span>
</td>
</tr>
<tr class="i_holdingrow_fld" style="border:0">
<td style="width: 31%;border:0;vertical-align: top;">
<strong><label style="font-weight:bold" id="i_labelfor_fld" for="i_fld">Original label text </label></strong>
</td>
<td style="width: 67%;border:0;">
<span id="i_holdingrow_fld"><input cf-field="fld" type="text" id="i_fld" name="fld" class="text large-field cf_text " title="Original label text"/></span>
</td>
</tr>
</tbody>
</table>
</div>
<button id="confiform_form_submit" class="save-cf-btn1" name="registrationFormSubmit" style="display: none">Save</button>
</form>
</div>
<div class="confiFormsFormFooter">
<button class="my-create-dialog-create-button aui-button aui-button-primary save-cf-btn" type="button" title="Save" data-msg=""
onclick="submitValidateEntryRequest(AJS.$(this), AJS.$('#i_confiform_registration_panel_ed7ac728ba71b5d617ab98348a33bee9').find('#i_confiform_registration_form'), null, AJS.$(this).attr('data-msg'))">Save</button>
<span class="aui-icon aui-icon-wait i_cf_rules_loading" style="display: none;">Wait</span>
</div>
</div>
</p><div>
<div class="noprint" style="display: none">
</div>
<span id="cf_messages" style="padding-bottom: 5px;"></span>
<script type="text/javascript">
var cfRowHL = false;
AJS.toInit(function () {
if (!cfRowHL) {
cfHandleHL('c6bb6a4faf9fcdc26ab41f0d921b22af');
}
});
</script>
<div style="margin-top: 5px">
</div>
</div>
<script>
function changeLabel(formName, formId) {
if (isPageViewMode()) {
AJS.$(formName).find('.i_holdingrow_fld').find('#i_labelfor_fld').html('New label text<span style="color:red;font-weight: bolder;float: right;font-size: larger;">*</span>');
}
}
function setInitialLabel(formName, formId) {
if (isPageViewMode()) {
AJS.$(formName).find('.i_holdingrow_fld').find('#i_labelfor_fld').html('Original label text');
}
}
function isPageViewMode() {
return AJS.$('#wysiwygTextarea_ifr').length === 0;
}
</script><p>Storage format for the solution / demo</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Confluence" data-theme="Confluence"><p>Online demo to demonstrate how to use ConfiForms Field Definition to change the field's label</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="88a8cf4f-69d5-4fb0-b25f-0f345d55f89f" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">myform1</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Click on change field to see the label change</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="f2cd0d55-92da-469d-897d-8730fe3e4311" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="embedded">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="90782ecc-2c2e-45e3-a71f-e0e937a932f4" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">change</ac:parameter>
<ac:parameter ac:name="fieldLabel">Change</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="c39eaa9d-bff2-4f15-999f-cda478fe327a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">fld</ac:parameter>
<ac:parameter ac:name="fieldLabel">Original label text</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="154f51cd-b772-4394-a81b-3e4088f527d8" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">change:true</ac:parameter>
<ac:parameter ac:name="values">changeLabel(formName, formId);</ac:parameter>
<ac:parameter ac:name="action">Run custom JavaScript</ac:parameter>
<ac:parameter ac:name="actionFieldName">change</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="d594b214-fc73-49bc-8246-fef23e63f494" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">change:false</ac:parameter>
<ac:parameter ac:name="values">setInitialLabel(formName, formId);</ac:parameter>
<ac:parameter ac:name="action">Run custom JavaScript</ac:parameter>
<ac:parameter ac:name="actionFieldName">change</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="9c1a3ad6-f46c-47cc-9935-9a42ffef665b" ac:name="html" ac:schema-version="1">
<ac:plain-text-body><![CDATA[<script>
function changeLabel(formName, formId) {
if (isPageViewMode()) {
AJS.$(formName).find('.i_holdingrow_fld').find('#i_labelfor_fld').html('New label text<span style="color:red;font-weight: bolder;float: right;font-size: larger;">*</span>');
}
}
function setInitialLabel(formName, formId) {
if (isPageViewMode()) {
AJS.$(formName).find('.i_holdingrow_fld').find('#i_labelfor_fld').html('Original label text');
}
}
function isPageViewMode() {
return AJS.$('#wysiwygTextarea_ifr').length === 0;
}
</script>]]></ac:plain-text-body>
</ac:structured-macro>
</pre>
</div></div>
</div>
<div style="padding: 10px 0;">
<a href="https://wiki.vertuna.com/display/TEST/Change+field+label+with+Field+Definition+rule+and+JavaScript">View Online</a>
·
<a href="https://wiki.vertuna.com/pages/diffpagesbyversion.action?pageId=42008598&revisedVersion=11&originalVersion=10">View Changes Online</a>
</div>
</div>
Alex Medved
2019-04-12T03:04:57Z