Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Prompt

Prompt (Drafts)

The ThoughtAsylum library includes a set of extensions to the Prompt object

Hierarchy

  • Prompt

Index

Methods

TA_confirm

  • TA_confirm(p_strTitle: string, p_strMessage: string): Boolean
  • 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'.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt

    • p_strMessage: string

      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?"));

    Returns Boolean

TA_decryptionPromptAES

  • TA_decryptionPromptAES(): string
  • 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());

    Returns string

TA_doubleTextFieldPrompt

  • TA_doubleTextFieldPrompt(p_strTitle: string, p_strMessage: string, p_strLabel1: string, p_strDefault1: string, p_strLabel2: string, p_strDefault2: string): string
  • Displays a prompt with two text fields to enter text strings into.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt

    • p_strMessage: string

      The optional text to display below the title detailing what the data capture is about.

    • p_strLabel1: string

      The text to display immediately above the first text entry field.

    • p_strDefault1: string

      The default value of the first text field. Can be set to blank.

    • p_strLabel2: string

      The text to display immediately above the second text entry field.

    • p_strDefault2: string

      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.

    Returns string

TA_encryptionPromptAES

  • TA_encryptionPromptAES(p_bAutoGenerate?: Boolean): TadKey
  • 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.

    Parameters

    • Optional p_bAutoGenerate: Boolean

      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());

    Returns TadKey

TA_multiSelectPrompt

  • TA_multiSelectPrompt(p_strTitle: string, p_strLabel: string, p_astrOptions: string[], p_astrDefaultSelected: string[]): string
  • A multi-selection prompt that constructs a lot of the details around using this type of prompt.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strLabel: string

      The text to display below the title detailing what the selection is about.

    • p_astrOptions: string[]

      An array of selection options for the user to choose from.

    • p_astrDefaultSelected: string[]

      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.

    Returns string

TA_promptButtonAction

  • TA_promptButtonAction(p_strTitle: string, p_strMessage: string, p_astrButtons: string[], p_astrActions: string[], p_bCancellable?: Boolean): string
  • 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.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strMessage: string

      Text to display below the title detailing what the selection is about. Can be set to blank.

    • p_astrButtons: string[]

      An array of text that defines the names of the buttons to be displayed.

    • p_astrActions: string[]

      An array of text that defines the names of the actions associated with those buttons.

    • Optional p_bCancellable: Boolean

      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));

    Returns string

TA_promptButtonArray

  • TA_promptButtonArray(p_strTitle: string, p_strMessage: string, p_astrButtons: string[], p_bCancellable?: Boolean): string
  • Displays a list of button options to select from as a prompt. Returns the text of the button, or null if cancelled.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strMessage: string

      Text to display below the title detailing what the selection is about. Can be set to blank.

    • p_astrButtons: string[]

      An array of text that defines the names of the buttons to be displayed.

    • Optional p_bCancellable: Boolean

      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.

    Returns string

TA_promptButtonArrayIndexed

  • TA_promptButtonArrayIndexed(p_strTitle: string, p_strMessage: string, p_astrButtons: string[], p_bCancellable?: Boolean): number
  • 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.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strMessage: string

      Text to display below the title detailing what the selection is about. Can be set to blank.

    • p_astrButtons: string[]

      An array of text that defines the names of the buttons to be displayed.

    • Optional p_bCancellable: Boolean

      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.

    Returns number

TA_promptButtonArrayValue

  • TA_promptButtonArrayValue(p_strTitle: string, p_strMessage: string, p_astrButtons: string[], p_astrValues: string[], p_bCancellable?: Boolean): string
  • Displays a list of button options to select from as a prompt and returns the text value associated with the selected button.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strMessage: string

      Text to display below the title detailing what the selection is about. Can be set to blank.

    • p_astrButtons: string[]

      An array of text that defines the names of the buttons to be displayed.

    • p_astrValues: string[]

      An array of text that defines the names of the buttons to be displayed.

    • Optional p_bCancellable: Boolean

      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.

    Returns string

TA_selectPrompt

  • TA_selectPrompt(p_strTitle: string, p_strLabel: string, p_astrOptions: string[], p_strSelected?: string): string
  • A simple single selection prompt that constructs a lot of the details around using this type of prompt.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt.

    • p_strLabel: string

      The text to display below the title detailing what the selection is about.

    • p_astrOptions: string[]

      An array of selection options for the user to choose from.

    • Optional p_strSelected: string

      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.

    Returns string

TA_singleIntegerFieldPrompt

  • TA_singleIntegerFieldPrompt(p_strTitle: string, p_strMessage: string, p_strLabel: string, p_intDefault?: number): number
  • Displays a prompt with a single text field to enter an integer into.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt

    • p_strMessage: string

      The optional text to display below the title detailing what the data capture is about.

    • p_strLabel: string

      The text to display immediately above the integer entry field.

    • Optional p_intDefault: number

      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.

    Returns number

TA_singleNumberFieldPrompt

  • TA_singleNumberFieldPrompt(p_strTitle: string, p_strMessage: string, p_strLabel: string, p_numefault?: number): number
  • Displays a prompt with a single text field to enter a number into.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt

    • p_strMessage: string

      The optional text to display below the title detailing what the data capture is about.

    • p_strLabel: string

      The text to display immediately above the number entry field.

    • Optional p_numefault: number

    Returns number

TA_singleTextFieldPrompt

  • TA_singleTextFieldPrompt(p_strTitle: string, p_strMessage: string, p_strLabel: string, p_strDefault?: string): string
  • Displays a prompt with a single text field to enter a text string into. Returns the entered text, or an empty string if cancelled.

    Parameters

    • p_strTitle: string

      The title to display at the top of the prompt

    • p_strMessage: string

      The optional text to display below the title detailing what the data capture is about.

    • p_strLabel: string

      The text to display immediately above the text entry field.

    • Optional p_strDefault: string

      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.

    Returns string