Date: Fri, 29 Mar 2024 08:05:42 +0200 (EET) Message-ID: <821009686.1155.1711692342896@wiki.vertuna.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1154_611113002.1711692342884" ------=_Part_1154_611113002.1711692342884 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page demonstrates how to use ConfiForms REST API with a bit of custom scripting to enable quick f= eedback form
We have a very simple form
With little bot of scripting to build custom UI for ConfiForms form
=
|
|
And some glueing code to link these parts together. See storage format b= elow for the complete solution
=20Storage format for the solution
<ac:= structured-macro ac:macro-id=3D"016628d1-7649-46d0-9da1-738e6db4ef84" ac:na= me=3D"confiform" ac:schema-version=3D"1"> <ac:parameter ac:name=3D"formName">feedbackForm1</ac:parameter&g= t; <ac:rich-text-body> <p> <ac:structured-macro ac:macro-id=3D"14193c01-7a5a-4de2-9301-c197f5= 31d755" ac:name=3D"confiform-field-definition" ac:schema-version=3D"1"> <ac:parameter ac:name=3D"fieldName">feedback</ac:parameter= > <ac:parameter ac:name=3D"fieldLabel">Feedback</ac:paramete= r> <ac:parameter ac:name=3D"values">good</ac:parameter> <ac:parameter ac:name=3D"extras">bad</ac:parameter> <ac:parameter ac:name=3D"type">checkbox</ac:parameter> </ac:structured-macro> </p> <p> <ac:structured-macro ac:macro-id=3D"bf9647d3-e1ef-4774-a87d-b2f53b= c1497b" ac:name=3D"confiform-field-definition" ac:schema-version=3D"1"> <ac:parameter ac:name=3D"fieldName">comment</ac:parameter&= gt; <ac:parameter ac:name=3D"fieldLabel">Comment</ac:parameter= > <ac:parameter ac:name=3D"type">textarea</ac:parameter> </ac:structured-macro> </p> </ac:rich-text-body> </ac:structured-macro> <table style=3D"width: 100.0%;border: 0;"> <tbody> <tr> <td style=3D"text-align: center;border: 0;"> <ac:structured-macro ac:macro-id=3D"86a09ce9-422e-4bbd-9cd6-b74f= afd4f9a1" ac:name=3D"html" ac:schema-version=3D"1"> <ac:plain-text-body><![CDATA[<img src=3D"https://wiki= .vertuna.com/download/attachments/11862271/thumbs-up.png?api=3Dv2" id=3D"th= umbsup" style=3D"cursor:pointer"/>]]></ac:plain-text-body> </ac:structured-macro> </td> <td style=3D"text-align: center;border: 0;"> <ac:structured-macro ac:macro-id=3D"fe93e240-e8d2-4e97-b73b-3a27= 1c12cefa" ac:name=3D"html" ac:schema-version=3D"1"> <ac:plain-text-body><![CDATA[<img src=3D"https://wiki= .vertuna.com/download/attachments/11862271/thumbs-down.png?api=3Dv2" id=3D"= thumbsdown" style=3D"cursor:pointer"/> <form class=3D"aui" style=3D"display:none" id=3D"fform"> <textarea id=3D"mycomment" class=3D"textarea" cols=3D"7" rows=3D"4">&= lt;/textarea><br/><input type=3D"button" class=3D"aui-button" v= alue=3D"Send" id=3D"sendcommneg"/> </form>]]></ac:plain-text-body> </ac:structured-macro> </td> </tr> </tbody> </table> <ac:structured-macro ac:macro-id=3D"a6aa6358-866e-432e-8a1e-c900fb56b0ce= " ac:name=3D"html" ac:schema-version=3D"1"> <ac:plain-text-body><![CDATA[<script type=3D"text/javascript"= > AJS.toInit(function() { =09AJS.$('#thumbsup').click(function(){ AJS.$.ajax({ url: 'https://wiki.vertuna.com/ajax/confiforms/rest/save.action?pag= eId=3D11862271&f=3DfeedbackForm1&feedback=3Dtrue', type: "GET", success: function (data) { AJS.$('#thankumsg1').show(); =09=09 window.setTimeout(function () { =09=09 =09AJS.$("#thankumsg1").fadeOut("slow"); =09=09 }, 2000); } =20 =09=09}); }); =20 AJS.$('#thumbsdown').click(function(){ =09AJS.$('#fform').show(); =09=09AJS.$('#mycomment').focus(); }); =20 =09AJS.$('#sendcommneg').click(function(){ =09=09AJS.$('#fform').hide(); AJS.$.ajax({ url: 'https://wiki.vertuna.com/ajax/confiforms/rest/save.action?pag= eId=3D11862271&f=3DfeedbackForm1&feedback=3Dfalse&comment=3D' += AJS.$('#mycomment').val() , type: "GET", success: function (data) { AJS.$('#thankumsg1').show(); =09=09 window.setTimeout(function () { =09=09 =09AJS.$("#thankumsg1").fadeOut("slow"); =09=09 }, 2000); } =20 =09=09}); }); =20 }); </script> =20 <div id=3D"thankumsg1" style=3D" display:none"> <div class=3D"aui-message aui-message-info closeable shadowed success"= > <p>Thank you for your feedback</p> </div> </div>]]></ac:plain-text-body> </ac:structured-macro> <p> </p> <p> </p>