Page tree

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.


ConfiForms allows you to inject your code into the form submit routine

Here are the events that ConfiForms triggers durinng the submit

function onCFSubmitStarted(formObject) {
  AJS.$(formObject).trigger('cfSubmitStarted', formObject);
}

function onCFSubmitFinished(formObject) {
  AJS.$(formObject).trigger('cfSubmitFinished', formObject);
}

function onCFSubmitError(formObject) {
  AJS.$(formObject).trigger('cfSubmitError', formObject);
}

function onCFBeforePrint(formObject, content) {
  AJS.$(formObject).trigger('cfBeforePrint', {"form": formObject, "content": content});
}

You can have a form that doe something like this to consume those events

<ac:structured-macro ac:macro-id="bdfbddee-ee93-4439-827d-ebdbe6199f75" ac:name="confiform-entry-register" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:parameter ac:name="afterLoadInit">handleEvents(formId)</ac:parameter>
  <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>
<ac:structured-macro ac:macro-id="8ae6842c-ff64-49bc-ac98-445d2aded4ae" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="8e05fb13-d6f5-4bdf-8c24-c8917e358096" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">t</ac:parameter>
        <ac:parameter ac:name="fieldLabel">t</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="5f71ad7a-dd8a-4d78-8f21-5a1459672799" ac:name="html" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[<script>

function handleEvents(formId) {
 AJS.$('#' + formId).on('cfSubmitStarted', function(formObject) {
   console.log(formObject);
 });

 AJS.$('#' + formId).on('cfSubmitFinished', function(formObject) {
   console.log(formObject);
 }); 

 AJS.$('#' + formId).on('cfSubmitError', function(formObject) {
   console.log(formObject);
 }); 

}

</script>]]></ac:plain-text-body>
</ac:structured-macro>

ConfiForms Registration Control macro has an after initialization method call to some custom function:

handleEvents(formId)

This function adds listeners to form object