INPUT /  OUTPUT /  LANGUAGE






dialog tag

Transient logic tag

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.

Sample usage

<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.

Fields

Primary field

Scalar field
Specifies a string of text for the user to be prompted with. For example, {Enter your name:}, or {Are you sure you wish to continue?}.

Secondary fields

Behaviour

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.

Notes

Although the dialog tag displays stuff on the screen, it behaves as a transient 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.

Example

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}>')