Sign In   Register

This article addresses the issue of submitting a form before document uploads are complete. It explains the root cause, provides steps to reproduce the problem, and offers guidance on resolution and potential workarounds.

Applicable To

  • Product/Service: Journey Manager (TJM) / Maestro
  • Module/Component: Attachments component
  • Versions: All versions where background save is supported

Prerequisites

    • Access to Maestro form design and rules configuration.
    • Browser developer tools (console) for debugging.
    • Ability to test and modify form rules.

    Problem

    In Journey Maestro, when using the Attachment component, the file upload process may take some time to complete depending on the network speed.

    If the user attempts to submit the form while the upload is still in progress, the attachment will not appear in the 'Attachment' section of the corresponding Journey Manager form transaction. However, the attachment details will still be present in the XML data of that transaction.

    Steps to Reproduce

    Step 1 Log in to Journey Maestro

    • Open Journey Maestro and create a new form (e.g., Attachment Upload Test Form).

    Step 2 Add an Attachment Component

    • From the Palette, drag and drop the Attachment component onto the form canvas.
    • Optionally, rename the field ID (e.g., attachmentField).
    • Save the form.

    Step 3 Add a Submit Button

    • Drag and drop a Button component below the attachment field.
    • Set the label as Submit.
    • Configure it to perform a Form Submit.
    • Save the form again.

    Step 4 Build and Deploy the Form

    • Click Build & DeployBuild the form.
    • Once the build is successful, deploy it to your Test Environment or Journey Manager.

    Step 5 Open the Form in a Browser

    • Access the deployed form URL in a web browser.
    • Ensure a moderate or slow internet connection to create a noticeable upload delay.
    • Prepare a relatively large file (e.g., 10–20 MB) for testing.

    Step 6 Upload and Submit During Upload

    • Start uploading the large file using the Attachment component.
    • While the upload is still in progress, click Submit.

    Step 7 Check the Transaction in Journey Manager

    • Log in to Journey Manager and open the Transactions.
    • Locate and open the transaction created by your test form submission.

    Step 8 Observe the Behavior

    • The uploaded file will not appear under the Attachments section of the transaction.
    • The attachment details, however, will be visible in the form XML data.

    Resolution

    This behavior occurs because once the attachment upload begins, the form data gets updated with details such as the attachment name and related metadata. When the form is submitted, the XML data is generated based on this updated form data.

    To avoid issues during submission, we can temporarily disable the form submission while the file upload is in progress. This can be handled by checking the value of:

    Form.data.attachmentField.$fileQueue[0].isUploading

    When a file is uploading, this property returns true, and once the upload completes, it becomes false.

    Using this logic, we can add a simple condition like:

    if (Form.data.attachmentField.$fileQueue[0]?.isUploading) {
     
      console.log("You cannot submit the form while the document is uploading.");
     
    } else {
     
      Form.submit();
     
    }

    This ensures the form cannot be submitted until the file upload is complete, preventing any data mismatch or submission errors.

    Important Notes

    • Before applying this change permanently, customers should be advised to thoroughly test their forms.
    • Additionally, if attachments are required, Maestro already provides a built-in option to make them mandatory. Proper validation should be performed to ensure that no unintended issues occur.