Online demo to demonstrate how to use ConfiForms Field Definition to change the field's label
Via dialog
ConfiForms (FormView) Registrations Control |
---|
|
|
Embedded form
ConfiForms (FormView) Registrations Control |
---|
formName | myform |
---|
embedded | true |
---|
|
|
ConfiForms Form Definition |
---|
formName | myform |
---|
registrationFormTitle | Click on change field to see the label change |
---|
|
trueINLINE changeChangecheckbox fldOriginal label texttext change:truechangeLabel(formName, formId);Run custom JavaScriptchange change:falsesetInitialLabel(formName, formId);Run custom JavaScriptchange |
HTML |
---|
<script>
function changeLabel(formName, formId) {
if (isPageViewMode()) {
AJS.$(formName).find('.i_holdingrow_fld').find('#i_labelfor_fld').html('New label text 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> |
...
Code Block |
---|
<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 texttext<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>
|