Prompts the user for input using a pop-up dialog box. The user may be prompted to select from multiple options, or enter text input.
<dialog title={Error} {You can't select that option now}>
— Displays an error message with only the option to cancel.
<dialog {Exit now?} choices={OK} symbol={?}>
— Displays a question prompt with a question mark symbol where the user can
either select "OK" or they can cancel the dialog prompt.
{Enter your name:}
, or
{Are you sure you wish to continue?}
.
When the tag is complete, user interaction with the console is temporarily suspended and a dialog prompt is shown to the user. After the user responds to the dialog prompt, the dialog tag generates a value containing the user's response to the prompt. The tag's lifetime then ends.
Although the dialog tag displays stuff on the screen, it behaves as an ephemeral logic tag rather than a presentation tag. This is because it evaluates and generates a result once, rather than creating a persistent object in the document tree.
The following example demonstrates how you can output a dialog tag from a Python program to get the user's response to a simple OK/Cancel question, and get the user's response input back to your program in the simple format of "Y" for yes or "N" for no.
user_response = input('<putLn|if <dialog {Are you sure you want to continue?} choices={OK}> then={Y} else={N}>')