Skip to content

Result actions ​

The result action decides what the editor does after the customer confirms the final verification and the print job has been saved: stay open, close, or show a confirmation dialog — optionally followed by a redirect. Set a default in the Admin Portal and override it per opening with a data attribute, a builder method or editor.result in the editor arguments.

TIP

Example: Result action · source

What the customer sees ​

  1. The customer clicks Continue (or a custom button with the FinalConfirm function, see Custom editor buttons).
  2. The Final Verification dialog shows every printing. The customer approves each one ("I agree and approve this print motive…"), can add comments and clicks Final Confirm.
  3. The editor saves the print job and fires the print job created (or updated) event.
  4. The editor runs the result action:
Result actionValueAfter the print job is saved
None'None'The verification dialog closes and the editor stays open. The customer closes it with ×.
Close'Close'The editor closes with the reason 'Confirmed' and, if a redirectUrl is set, the script navigates there. This is the Admin Portal default.
Dialog'Dialog'The editor shows a small dialog with a title, a message and one button. The button closes the editor with the reason 'Confirmed' and, if a redirectUrl is set, the script navigates there.

The result action doesn't give you the print job GUID — listen to the print job events for that.

Set the result action for one opening ​

html
<button data-td-action="OpenCreate"
        data-td-supplier-code="PFC"
        data-td-product-code="10086021"
        data-td-print-position-code="front"
        data-td-print-technology-code="PAD03"
        data-td-result-action="Dialog"
        data-td-result-redirect-url="/cart">
  Design your print
</button>
js
window.tronDesigner
  .setExactProduct('PFC', undefined, (product) => product.addVariant('10086021'))
  .addExactPrinting('front', 'PAD03')
  .setResultActionShowDialog(
    [
      { language: 'en', title: 'Print graphics ready', message: 'Your design has been saved.', buttonText: 'Continue to cart' },
      { language: 'de', title: 'Druckgrafik bereit', message: 'Ihr Design wurde gespeichert.', buttonText: 'Weiter zum Warenkorb' },
    ],
    '/cart'
  )
  .open({ mode: 'dialog' });
js
window.tronDesigner.openDesigner(
  {
    openMode: 'Create',
    dataMode: 'Exact',
    printJob: {
      addProducts: { supplierCode: 'PFC', variants: [{ productCode: '10086021' }] },
      addPrintings: [{ printPositionCode: 'front', printTechnologyCode: 'PAD03' }],
    },
    editor: {
      result: {
        resultAction: 'Dialog',
        redirectUrl: '/cart',
        closeDialog: [
          { language: 'en', title: 'Print graphics ready', message: 'Your design has been saved.', buttonText: 'Continue to cart' },
        ],
      },
    },
  },
  { mode: 'dialog' }
);

Builder methods ​

MethodResulting editor.result
setResultActionNone(){ resultAction: 'None' }
setResultActionCloseEditor(redirectUrl?){ resultAction: 'Close', redirectUrl }
setResultActionShowDialog(dialogs, redirectUrl?){ resultAction: 'Dialog', redirectUrl, closeDialog: dialogs }

Each call replaces the previous result action.

editor.result in JSON ​

EditorResult has three fields:

FieldTypeMeaning
resultAction'None' | 'Close' | 'Dialog'Required. Case-sensitive: 'CLOSE', 'NONE' or 'dialog' aren't recognized and the editor treats them as 'None'.
redirectUrlstringOptional. Where to send the customer after a confirmed close (see Redirect after the confirmation).
closeDialogEditorResultDialog[]Optional. The dialog texts for 'Dialog', one entry per language. Without it the built-in texts are shown.

Use the same object in data-td-options (see Editor arguments).

Data attributes ​

AttributeValues
data-td-result-actionNone, Close or Dialog — exactly these, case-sensitive. Any other value throws Invalid resultAction attribute value: … when the customer clicks, and the editor doesn't open.
data-td-result-redirect-urlThe redirect URL for Close and Dialog. Ignored without data-td-result-action.

Dialog set through attributes always uses the built-in dialog texts; for your own texts use data-td-options or JavaScript.

Localize the confirmation dialog ​

closeDialog is an array — one EditorResultDialog per language:

FieldMeaning
languageISO 639-1 code of the editor language, e.g. 'en', 'de', 'cs' (Czech is cs, not cz). Matching ignores case.
titleDialog title
messageText next to the success icon
buttonTextLabel of the only button

The editor shows the entry for its current language, then falls back to the en entry, then to the first entry, and finally to the built-in texts (Print job saved / Your print design was successfully saved / RETURN TO SHOP in English; they follow the editor language and can be changed in the Admin Portal under Settings → Print editor → Custom Translations).

closeDialog is optional: with 'Dialog' and no closeDialog (or [], which is what data-td-result-action="Dialog" sends), the editor shows the built-in texts. Give every entry a language — an entry without one is never matched by language and is used only as the "first entry" fallback.

Redirect after the confirmation ​

When the editor closes with the reason 'Confirmed' and a redirect URL, the script calls your onClose and then sets window.location.href to the URL (see Dialog and inline display). Relative URLs such as /cart resolve against your page. Only http and https URLs are followed: any other scheme (for example javascript:) is ignored and logged as an error.

CloseRedirect URL passedScript navigates
Result action Dialog, customer clicks the dialog buttonyesyes
Result action Close, after the final confirmationyesyes
Custom button SaveAndClose or DownloadProofreadingAndCloseyes (the same redirectUrl, whatever the result action)yes (SaveAndClose closes only when the print job was saved)
Result action None— (the editor stays open)no
Customer cancels (×) or closes an error dialognono

Both setResultActionCloseEditor(redirectUrl) and data-td-result-action="Close" + data-td-result-redirect-url redirect on their own. Your onClose runs first, so you can still store state before the page changes:

js
window.tronDesigner
  .setExactProduct('PFC', undefined, (product) => product.addVariant('10086021'))
  .addExactPrinting('front', 'PAD03')
  .setResultActionCloseEditor('/cart')
  .open({
    mode: 'dialog',
    onClose: (reason) => {
      // 'Confirmed' after the final confirmation (the script then goes to /cart); 'Cancelled' after ×
      console.log('Editor closed:', reason);
    },
  });

Even with a redirect, save the print job GUID from the print job event first — see Events and callbacks.

Set the default in the Admin Portal ​

In the Admin Portal open Settings → Print editor → Behavior and the card Result Action (after final verification):

  • Result action — none, close the editor, or show a dialog;
  • Redirect URL — optional;
  • Result dialog text — title, message and button text per language (required for the dialog).

Without any configuration, the result action is Close with no redirect. The settings can be stored globally or for a specific API key.

Which setting wins ​

If the editor arguments contain editor.result — from JSON, data-td-options, a setResultAction…() call or the data-td-result-action attribute — it replaces the Admin Portal setting completely: action, redirect URL and dialog texts. Nothing is merged, so setResultActionShowDialog([]) shows the built-in texts and doesn't redirect even if the Admin Portal has a redirect URL and dialog texts. Without editor.result, the Admin Portal setting applies.

See also ​

Czech Republic – The Country for the FutureFunded by the European Union – NextGenerationEUThe project was implemented within the The Country for the Future programme of the Ministry of Industry and Trade and co-financed by the European Union under NextGenerationEU.Support · Examples

Czech Republic – The Country for the FutureFunded by the European Union – NextGenerationEUThe project was implemented within the The Country for the Future programme of the Ministry of Industry and Trade and co-financed by the European Union under NextGenerationEU.Support · Examples