Child pages
  • Using web-service backed fields

This is the documentation for ConfiForms Server/Data Center app

However, this might also work for ConfiForms cloud and in most cases it does. But please see this page to understand the differences between server and cloud versions of the ConfiForms app.

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


What post would you like to suggest for correction?
This is the original content as fetched from our site. Please change it at your will.

<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

Post

Proposed changes in body

Original (current) content

All he wanted was a candy bar. All he wanted was a candy bar. It didn't seem like a difficult request to comprehend, but the clerk remained frozen and didn't seem to want to honor the request. It might have had something to do with the gun pointed at his face. All he wanted was a candy bar. It didn't seem like a difficult request to comprehend, but the clerk remained frozen and didn't seem to want to honor the request. It might have had something to do with the gun pointed at his face.
Hopes and dreams were dashed that day. Just remove it Hopes and dreams were dashed that day. It should have been expected, but it still came as a shock. The warning signs had been ignored in favor of the possibility, however remote, that it could actually happen. That possibility had grown from hope to an undeniable belief it must be destiny. That was until it wasn't and the hopes and dreams came crashing down.

    <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>
  • No labels