Displays a confirmation prompt - a question with a yes/no response.
Returns true
if the response is 'Yes', and false
if the answer is 'No'.
The title to display at the top of the prompt
The optional text to display below the title detailing what the data capture is about.
// Example
alert(Prompt.TA_confirm ("Continue?", "Do you wish to continue?"));
Capture a manually entered decryption key. The entered key is returned, unless the prompt is cancelled, in which case a null string is returned. A null is also returned if the user enters OK without entering a key.
// Example
alert(Prompt.TA_decryptionPromptAES());
Displays a prompt with two text fields to enter text strings into.
The title to display at the top of the prompt
The optional text to display below the title detailing what the data capture is about.
The text to display immediately above the first text entry field.
The default value of the first text field. Can be set to blank.
The text to display immediately above the second text entry field.
The default value of the first second field. Can be set to blank.
// Example
alert(Prompt.TA_doubleTextFieldPrompt("Favourites", "Part 1: Favourite Cities", "What is your favourite city?", "Vancouver", "What is your second favourite city?", "Toronto"));
// Displays a prompt with a specified title, message, field labels and text entry fields.
// The names of the entered cities are displayed as a comma separated list. If cancelled, both entries will be blank, and the user can also manually submit blank entries.
Capture a manually entered encryption key, or generate a 128/192/256-bit key as required.
If a manual key is entered, this works just like a simple prompt with a single text entry field, returning the key.
If a manual key is not entered, and auto key generation is enabled, the prompt will fallback to the bitness selection of the key
generation and then generate a key of 128, 192, or 256 bits. The keys are generated as hexadecimal strings of 32/48/64 characters
respectively and the keys are generated via the random.org API so as to be truly random, rather than pseudo random.
The function returns a TadKey
object, which has key
value (the entered/genearted key), and an auto
value which is set to
true
if the key was automatically genearted, and false
if it was entered by the user. If the prompt is cancelled,
or if auto generation of a key is disabled and no key is entered, the prompt will return a null string.
when true
(default), the prompt will auto generate a key if none is entered. When false
, the user must enter a key.
// Example
alert(Prompt.TA_encryptionPromptAES());
A multi-selection prompt that constructs a lot of the details around using this type of prompt.
The title to display at the top of the prompt.
The text to display below the title detailing what the selection is about.
An array of selection options for the user to choose from.
The default options that should be selected. If not set, it will default to none selected by default.
// Example
alert(Prompt.TA_multiSelectPrompt("Where in the world?", "Where would you like to go this week?", ["London","Cardiff","Edinburgh","Belfast"], ["Cardiff","Belfast"]));
// Displays a choice of places to visit this week with Cardiff and Belfast selected by default.
// The names of the selected destination are displayed as a comma separated list if OK'd, undefined if cancelled.
Displays a list of button options to select from as a prompt and returns the Drafts action name associated with the selected button.
If the user cancels, the ThoughtAsylum action group action of TA-Null Action
will be returned. This action does absolutely nothing when run.
The title to display at the top of the prompt.
Text to display below the title detailing what the selection is about. Can be set to blank.
An array of text that defines the names of the buttons to be displayed.
An array of text that defines the names of the actions associated with those buttons.
When set to true
(default), the prompt will display a cancel button. When set to false
it will not.
// Example
alert(Prompt.TA_promptButtonAction("Process Draft", "What would you like to do", ["Duplicate","Archive","File"], ["Dupe Draft", "Tag and Archive", "Tag as Working"], true));
Displays a list of button options to select from as a prompt.
Returns the text of the button, or null
if cancelled.
The title to display at the top of the prompt.
Text to display below the title detailing what the selection is about. Can be set to blank.
An array of text that defines the names of the buttons to be displayed.
When set to true
(default), the prompt will display a cancel button. When set to false
it will not.
// Example
alert(Prompt.TA_promptButtonArray("Where in the world?", "Where would you like to go this week?", ["London","Cardiff","Edinburgh","Belfast"], true));
// Displays a choice of places to visit this week.
// The name of the selected destination is displayed if selected, and `blank` if cancelled.
Displays a list of button options to select from as a prompt and returns the index of the button selected. The index is zero-based.
The title to display at the top of the prompt.
Text to display below the title detailing what the selection is about. Can be set to blank.
An array of text that defines the names of the buttons to be displayed.
When set to true
(default), the prompt will display a cancel button. When set to false
it will not.
// Example
alert(Prompt.TA_promptButtonArrayIndexed("Where in the world?", "Where would you like to go this week?", ["London","Cardiff","Edinburgh","Belfast"], true));
// Displays a choice of places to visit this week.
// The index of the selected destination is displayed if selected, and `blank` if cancelled.
Displays a list of button options to select from as a prompt and returns the text value associated with the selected button.
The title to display at the top of the prompt.
Text to display below the title detailing what the selection is about. Can be set to blank.
An array of text that defines the names of the buttons to be displayed.
An array of text that defines the names of the buttons to be displayed.
When set to true
(default), the prompt will display a cancel button. When set to false
it will not.
// Example
alert(Prompt.TA_promptButtonArrayValue("Where in the world?", "Where would you like to go this week?", ["London","Cardiff","Edinburgh","Belfast"], ["EN", "WA", "SC", "NI"], true));
// Displays a choice of places to visit this week.
// The value of the selected destination is displayed if selected, and `blank` if cancelled.
A simple single selection prompt that constructs a lot of the details around using this type of prompt.
The title to display at the top of the prompt.
The text to display below the title detailing what the selection is about.
An array of selection options for the user to choose from.
The default option that should be selected. If not set, it will default to the first option.
// Example
alert(Prompt.TA_selectPrompt("Where in the world?", "Where would you like to go today?", ["London","Cardiff","Edinburgh","Belfast"], "Cardiff"));
// Displays a choice of places to visit with Cardiff selected by default.
// The name of the selected destination is displayed if OK'd, undefined if cancelled.
Displays a prompt with a single text field to enter an integer into.
The title to display at the top of the prompt
The optional text to display below the title detailing what the data capture is about.
The text to display immediately above the integer entry field.
The default value of the text field. Defaults to 0.
// Example
alert(Prompt.TA_singleIntegerFieldPrompt("A Question of Primes", "I hear that you're pretty good at pime numbers.", "What the next prime number after 9973?", 9977));
// Displays a prompt with a specified title, message, field label and text entry field.
// The field is pre-populated with 9977 (and yes, we know that isn't a prime number), and on selecting OK, the number entered in the field will be displayed,
// and undefined if cancelled or the entry is manually blanked and OK'd.
Displays a prompt with a single text field to enter a number into.
The title to display at the top of the prompt
The optional text to display below the title detailing what the data capture is about.
The text to display immediately above the number entry field.
Displays a prompt with a single text field to enter a text string into. Returns the entered text, or an empty string if cancelled.
The title to display at the top of the prompt
The optional text to display below the title detailing what the data capture is about.
The text to display immediately above the text entry field.
The default value of the text field. Defaults to blank.
// Example
alert(Prompt.TA_singleTextFieldPrompt("Favourites", "Part 1: Favourite Cities", "What is your favourite city?", "Berlin"));
// Displays a prompt with a specified title, message, field label and text entry field.
// The field is pre-populated with Berlin, and on selecting OK, the text entered in the field will be displayed, and null if cancelled or the entry is manually blanked and OK'd.
Prompt (Drafts)
The ThoughtAsylum library includes a set of extensions to the Prompt object