The body of the prompt.
The title of the prompt. If omitted, no title is used.
The initial value of the field that the user edits. If omitted, the initial value is blank.
The label of the cancel button. If omitted, a default label is used, whose exact wording depends on the language the app has been configured to use. "Cancel" is used for apps in English.
The label of the OK button. If omitted, a default label is used, whose exact wording depends on the language the app has been configured to use. "OK" is used for apps in English.
A formula fragment that is expected to return TRUE if the OK button
should be enabled and FALSE otherwise. To do its work, it has access to
the entered value under the name
Input. If omitted, the OK
button is always enabled.
A promise, which succeeds if the OK button is pressed, returning the entered number, and fails if the cancel button is pressed. Pass this promise as the first parameter to AWAIT (and related functions) to take action after the promise has succeeded or failed.
Prompts the user for a number and returns a promise with the entered value. AWAIT(PROMPT.NUMBER("Enter a number:"), BANNER("You entered " & Result))AWAIT(PROMPT.NUMBER("Enter a number:"); BANNER("You entered " & Result)) asks the user for a number and displays it once it has been entered.
This function can only be used from an action formula. It is typically invoked from a formula associated with the OnPress property of a formula button.
Title parameter may be used to set the title of the prompt.
InitialValue to provide the value of the number field the
user edits when the prompt is first shown. If either parameter is omitted, a
blank value is assumed.
The prompt has a cancel button and an OK button. The labels may be set using
respectively. If a label is omitted, a label appropriate for the language of
the app is used.
To prompt the user for a text string, use PROMPT instead.
Reading the entered number
PROMPT returns a promise, effectively promising to return the entered value at some point in the future. Use AWAIT to read the value.
The first parameter to AWAIT should be the promise returned from PROMPT and
the second parameter should be a formula fragment that is run when the user
presses the OK button. The formula fragment has access to the entered value
under the name
This formula asks the user to enter a value and then stores this value as the hidden field Concentration before sending a report containing that field and the Volume field:
The formula stores the value using :=, which assigns values to properties. ;;; separates actions in an action formula, which are run one after the other.
The OK button of the prompt is enabled at all times, meaning that any number is accepted. For a formula that only accepts positive values, see below.
Determining if the OK button should be enabled
OkButtonEnabled parameter may be set to a formula fragment
which returns whether the OK button is enabled. To do its work, it has access
to the input number provided by the user, under the name
The formula fragment is run every time the user makes a change to determine
if the OK button should be enabled.
This formula only enables the OK button if the entered number is positive:
This formula only enables the OK button if the entered number is greater than or equal to the value of the field MinimumConcentration:
Asking multiple questions
With AWAIT, an arbitrary number of questions can be asked in succession. As an exercise, let's write a formula that asks a user their name and age and displays this information.
This formula asks the user for their name and displays it as a banner:
We need to expand on this formula and ask the user's age too. Here's a first attempt:
That works, but the banner only displays the age of the user, not their name.
Displaying both collected text strings presents us with a problem: as the
entered age is available under the name
Result, there is no way
to access the entered name, which is also available as
Essentially, the new invocations of AWAIT and PROMPT overwrite the name with
the age, making the name inaccessible.
This problem can be solved by renaming the results returned from AWAIT using
->, making them available under distinct names:
Asks the user for a number and displays it once it has been entered.
Asks the user for their name, then asks the user for their age, and
finally displays an alert containing the information the user entered.
The information the user enters is available as the values
Age, which is accomplished using
Asks the user to enter a concentration and then assigns this number to
the value of the Concentration field, which it then sends in a
email@example.com, along with the Volume
field. The OK button is only enabled if the entered number is positive.
Asks the user to provide a value and then stores this value as the value of the hidden field StoredValue, which retains its value even when the app is closed. The initial value of the prompt is set to the value of StoredValue, ensuring that the user is presented with their previously-entered value the next time the formula is run.