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

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

    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