Modifying ConfiForms field descriptions?
Asked by Dan:

This is either really easy, or it can't be done...

Is there a way to update Confiforms field descriptions? Either by rule, or javascript, or whathaveyou? Field labels are easy enough to change, but I would like to update the description as well. I did do a fair bit of research trying to find an answer for this, in an effort to not ask another question with an obvious answer, but I couldn't find anything (which guarantees nothing... hah).

Thanks in advance!


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Dan](/t5/user/viewprofilepage/user-id/5293201)

Field description is something what is defined in the ConfiForms Field Definition macro and is configurational parameter. Cannot be changed dynamically - but through the macro editor

Alex

comments: author: Dan
body: I.e. "once it is set, it's set"? That seemed to be the case. I was hoping to dynamically generate and embed a hyperlink into the field description based upon the value they enter into the field so they could get some real time guidance from our How To documentation (before actually submitting the form).


author: Alex Medved _ConfiForms_
body: You can put a hyperlink in the description parameter of the ConfiForms Field Definition macro. It accepts HTML (no scripting, it is sanitized with OWASP rules)


author: Dan
body: Yes, I saw that - and we do utilize that :) - there's just no way to dynamically change the description which would have been very helpful. It is hardcoded in the macro and permanent.


author: Alex Medved _ConfiForms_
body: Yeah, sorry.. not possible at the moment without some custom JavaScript...

<http://recordit.co/71vaDBRKu2>

With a configuration for the reference below...

```
<ac:structured-macro ac:macro-id="58cee102-35e0-4cde-9aad-73e7bca9784f" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="6a3f8b69-a2ad-4030-9fab-81853d022c3b" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="8741abbe-0681-492f-9b1d-c97414751501" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">c</ac:parameter>
<ac:parameter ac:name="fieldLabel">change description</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="cb61a799-66ac-4dd0-84de-7c16a34cdb08" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">myfield</ac:parameter>
<ac:parameter ac:name="fieldLabel">my field</ac:parameter>
<ac:parameter ac:name="fieldDescription">with some description</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="627acb54-fe21-4fba-9235-7cad23d2ecd8" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">c:true</ac:parameter>
<ac:parameter ac:name="values">changeDescription(formId, 'myfield')</ac:parameter>
<ac:parameter ac:name="action">Run custom JavaScript</ac:parameter>
<ac:parameter ac:name="actionFieldName">c</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b02ac52e-5933-4614-b587-d949ed133904" ac:name="html" ac:schema-version="1">
<ac:plain-text-body><![CDATA[<script>
function changeDescription(formId, fieldName){
AJS.$('#' + formId).find('span[id="i_holdingrow_myfield"]').parent().find('div.description').html('New description');
}
</script>]]></ac:plain-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
```

Alex


author: Dan
body: In conjunction with the Run Custom Javascript rule, your code above gave me exactly what I needed:

```
<script>
function changeDescription(formId, myfield, myNewDescription){
AJS.$('#' + formId).find('span[id="i_holdingrow_' + myfield + '"]').parent().find('div.description').html(myNewDescription);
}
</script>
```

As always, you're a rock star :). Thank you!


Tags: confiforms

confluence-server

server