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
- The customer clicks Continue (or a custom button with the
FinalConfirmfunction, see Custom editor buttons). - 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.
- The editor saves the print job and fires the print job
created(orupdated) event. - The editor runs the result action:
| Result action | Value | After 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
<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>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' });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
| Method | Resulting 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:
| Field | Type | Meaning |
|---|---|---|
resultAction | 'None' | 'Close' | 'Dialog' | Required. Case-sensitive: 'CLOSE', 'NONE' or 'dialog' aren't recognized and the editor treats them as 'None'. |
redirectUrl | string | Optional. Where to send the customer after a confirmed close (see Redirect after the confirmation). |
closeDialog | EditorResultDialog[] | 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
| Attribute | Values |
|---|---|
data-td-result-action | None, 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-url | The 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:
| Field | Meaning |
|---|---|
language | ISO 639-1 code of the editor language, e.g. 'en', 'de', 'cs' (Czech is cs, not cz). Matching ignores case. |
title | Dialog title |
message | Text next to the success icon |
buttonText | Label 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.
| Close | Redirect URL passed | Script navigates |
|---|---|---|
Result action Dialog, customer clicks the dialog button | yes | yes |
Result action Close, after the final confirmation | yes | yes |
Custom button SaveAndClose or DownloadProofreadingAndClose | yes (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 dialog | no | no |
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:
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
- EditorResult, EditorResultAction, EditorResultDialog — API reference
- Dialog and inline display —
onCloseand close reasons - Custom editor buttons —
SaveAndCloseand other buttons that close the editor - Events and callbacks