Test condition for "cancel" or "continue" with HTML Preview?

I’m doing some work converting my Prompts to HTML Previews (which are so much nicer, even if they take a bit more work to craft) and I’m having some trouble testing for whether “cancel” or “continue” or something else was pressed in the preview window.

Here’s the condition:

I created a script that feeds a bunch of JSON data into various fields to create some HTML and then the script says:

let preview = HTMLPreview.create();
preview.show(webpage);

    if (preview.show)
{

In my script, I will either press “cancel” on the preview window or I will press the custom HTML button I created to send data to the next part of the script. How can I test for whether I pressed “cancel”? Preview.show isn’t quite right I know see–it’s just testing for whether the preview showed or not.

The docs could stand to elaborate on this a bit, but the show function returns a Boolean value to indicate the continue/cancel status. You want something like this:

if (preview.show(webpage)) {
  // continue was pressed
}
else {
  // cancel was pressed
}
1 Like

yes, thanks. Most of the examples I’ve seen of HTML previews don’t script them–they use the HTML Preview step instead so I wasn’t sure how to do this. An example on that HTML preview page would definitely be useful!

Ok, some clarification for anyone confused:

The code should look like this:

let preview = HTMLPreview.create();

if (preview.show(webpage)) {
  // continue was pressed
}
else {
  // cancel was pressed
}