Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Question :

  • I want a way to allow people to suggest improvements to my blogposts.
  • My blogposts are available in JSON. Visitors should be able to pick a blogpost, and then provide a corrected version of the post.
  • For that they will pick a blogpost from a dropdown that is populated by the JSON.
  • When they pick a post, the field with the corrected content is automatically filled with the corresponding text.
  • They can edit the text and submit.
  • In the overview you want to be able to see both the original (current) text and the proposed text.

Approach


  • Set up webservice :
    • Add the URL to the global allowlist.
    • In confiforms administration : Create a Webservice (dummyjson.com.posts) connection to the JSON : https://dummyjson.com/posts
    • test the connection
  • Create a form
    • create a field "postid" definition of type : webservice dropdown
    • create a textarea field "body"
  • Add a confiform rule to the form
    • Track the field "postid", and choose "set value" as action. body=[entry.postid.body]
  • Add a tableview showing both the stored entry (body) as the referenced body (postid.body)


Propose changes or corrections


ConfiForms Form Definition
formNametextfeedback
Register normalEmbedded


posts|id|titlepostidPost0e8c178faef99da0ddf5747bb5b2451eWhat post would you like to suggest for correction?wsselect2

|id|colorbodyOriginal online textca15fd43dfaeb80eb8c125735e0479b0This is the original content as fetched from our site. Please change it at your will.textarea

shape=[entry.crmid.shape]body=[entry.postid.body]Set valuetruepostidca15fd43dfaeb80eb8c125735e0479b0

_user:[empty]Sorry, we dont accept feedback from anonymous users at this timeValidation rule


Code Block
languagexml
<h2>Propose changes or corrections</h2>
      <ac:structured-macro ac:macro-id="912b4c89-af05-46af-a7d3-bd7173036dca" ac:name="confiform" ac:schema-version="1">
        <ac:parameter ac:name="formName">textfeedback</ac:parameter>
        <ac:rich-text-body>
          <ac:structured-macro ac:macro-id="d0e84d66-1c6b-4e50-97fd-8ac9d912ae6f" ac:name="confiform-entry-register" ac:schema-version="1">
            <ac:parameter ac:name="registrationButtonLabel">Register normal</ac:parameter>
            <ac:parameter ac:name="type">Embedded</ac:parameter>
            <ac:rich-text-body>
            </ac:rich-text-body>
          </ac:structured-macro>
          <ac:structured-macro ac:macro-id="f888c476-52e7-4575-9a5a-e2f3f00f6630" ac:name="confiform-field-definition" ac:schema-version="1">
            <ac:parameter ac:name="mapping">posts|id|title</ac:parameter>
            <ac:parameter ac:name="fieldName">postid</ac:parameter>
            <ac:parameter ac:name="fieldLabel">Post</ac:parameter>
            <ac:parameter ac:name="extras">95212fa88436c556b3b13a1a452a0a71</ac:parameter>
            <ac:parameter ac:name="fieldDescription">What post would you like to suggest for correction?</ac:parameter>
            <ac:parameter ac:name="type">wsselect2</ac:parameter>
          </ac:structured-macro>
          <p>
            <ac:structured-macro ac:macro-id="17b401f5-d7ff-43a4-892e-5eb4824f567f" ac:name="confiform-field-definition" ac:schema-version="1">
              <ac:parameter ac:name="mapping">|id|color</ac:parameter>
              <ac:parameter ac:name="fieldName">body</ac:parameter>
              <ac:parameter ac:name="fieldLabel">Original online text</ac:parameter>
              <ac:parameter ac:name="extras">ca15fd43dfaeb80eb8c125735e0479b0</ac:parameter>
              <ac:parameter ac:name="fieldDescription">This is the original content as fetched from our site. Please change it at your will.</ac:parameter>
              <ac:parameter ac:name="type">textarea</ac:parameter>
            </ac:structured-macro>
          </p>
          <p>
            <ac:structured-macro ac:macro-id="a6124c2b-ffc9-43b4-83eb-33422e6af03b" ac:name="confiform-field-definition-rules" ac:schema-version="1">
              <ac:parameter ac:name="fieldName">shape=[entry.crmid.shape]</ac:parameter>
              <ac:parameter ac:name="values">body=[entry.postid.body]</ac:parameter>
              <ac:parameter ac:name="action">Set value</ac:parameter>
              <ac:parameter ac:name="onUserActionOnly">true</ac:parameter>
              <ac:parameter ac:name="actionFieldName">postid</ac:parameter>
              <ac:parameter ac:name="values2">ca15fd43dfaeb80eb8c125735e0479b0</ac:parameter>
            </ac:structured-macro>
          </p>
        </ac:rich-text-body>
      </ac:structured-macro>

List of proposed changes

ConfiForms TableView
formNametextfeedback

postid Proposed changes in bodybody Original (current) contentpostid.body


Code Block
languagexml
    <h2>List of proposed changes</h2>
      <ac:structured-macro ac:macro-id="8ea45427-fe4b-4546-8c9e-9fe7eb48bcc9" ac:name="confiform-table" ac:schema-version="1">
        <ac:parameter ac:name="formName">textfeedback</ac:parameter>
        <ac:rich-text-body>
          <p>
            <ac:structured-macro ac:macro-id="8e2d38da-5fa7-445c-839e-2628436b1863" ac:name="confiform-field" ac:schema-version="1">
              <ac:parameter ac:name="fieldName">postid</ac:parameter>
            </ac:structured-macro>
            <ac:structured-macro ac:macro-id="ad11c6f5-9dc2-4516-9169-ba7c801a42dd" ac:name="confiform-field" ac:schema-version="1">
              <ac:parameter ac:name="overrideLabel">Proposed changes in body</ac:parameter>
              <ac:parameter ac:name="fieldName">body</ac:parameter>
            </ac:structured-macro>
            <ac:structured-macro ac:macro-id="95c27822-605f-4776-9a2d-804aa7bec873" ac:name="confiform-field" ac:schema-version="1">
              <ac:parameter ac:name="overrideLabel">Original (current) content</ac:parameter>
              <ac:parameter ac:name="fieldName">postid.body</ac:parameter>
            </ac:structured-macro>
          </p>
        </ac:rich-text-body>